Re: CGI Tables
by dws (Chancellor) on Mar 30, 2003 at 00:31 UTC
|
Can someone please show me an example of how to include html tables under CGI, even if it's not the best choice?
This question was asked and answered two days ago, in Constructing HTML tables with CGI.pm. If that thread doesn't answer your question, please restate your problem.
| [reply] |
(jeffa) Re: CGI Tables
by jeffa (Bishop) on Mar 30, 2003 at 14:29 UTC
|
dws has you covered, but i felt very inclined to offer a
little advice. If you don't know anything about X but you
know a bit about Y, even if you know X is better, you should
probably stick with what you know. I primarily use CSS for
markup -- i have only (successfully) used CSS for
layout/positioning at
one site i created. Even
though i agree we should use CSS instead of tables for
layout, the fact remains that i can get the job done
quicker (and know what i am doing) with tables than with
CSS. I am not saying i shouldn't be using CSS for layout, i
am simply saying that i don't have time right now
to really grok CSS.
Having said all of that, should you wish to see what
using CGI.pm and CSS layout looks like instead of more
examples that you can get from dws's link above ...
here is an example that uses
CGI.pm to recreate the
two box
example from Owen Briggs'
Box Lessons. But first, here are some links from
hacker of sites that he has designed using CSS instead
of tables. Hope this helps. :)
use strict;
use warnings;
use CGI qw(:standard);
my $style = do {local $/;<DATA>};
print header(),
start_html(-style=>{-code=>$style}),
div({-id=>'content'}, 'blah ' x 40),
div({-id=>'content2'}, 'blah ' x 40),
end_html,
;
__DATA__
#content {
float: left;
padding: 10px;
margin: 20px;
background: #666;
border: 5px solid #ccc;
width: 300px;
/* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
width: 270px;
}
html>body #content {
width: 270px;
/* ie5win fudge ends */
}
#content2 {
float: left;
padding: 10px;
margin: 20px;
background: #666;
border: 5px solid #ccc;
width: 300px;
/* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
width: 270px;
}
html>body #content2 {
width: 270px;
/* ie5win fudge ends */
}
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
| [reply] [d/l] |
Re: CGI Tables
by hacker (Priest) on Mar 30, 2003 at 16:26 UTC
|
Tables are for tabluar data, period. If your data inside those tables would look "odd" inside a spreadsheet, then it's the wrong use of tables.
For two examples of how to use CSS-only for laying out a pretty complicate table-like page, check out these two sites I've designed. Both of them are using CGI.pm on the back-end (and mod_perl, mysql, etc. to drive content from the database); Plucker and pilot-link, and also a quick hack I did a couple of days ago with a CSS-based form (thanks to jeffa amending his reply above, grr ;). Each of them was done in validated XHTML and pure validated CSS, not a single table tag to be found anywhere.
That being said, you should really explore using CSS for what you're trying to do, simply because it has a lot more benefits than tables. Nested tables are a nightmare to maintain, and it is also a lot more code than equivalent CSS (if done right), which makes the CSS pages smaller and faster to deliver to the client. It also separates content from presentation, which allows you (the developer) to work on the site design itself, the back-end code, etc. and let your web-developers work on the look-n-feel of the site, irrespective of what your code outputs.
Also, with proper implementation of User Styles (hit the View->User Style option in your browser's menu to see the 15 different client-side-activated stylesheets on that link), you can change the layout of your page without changing any of your actual page content itself.
One thing many "designers" forget, is that not everyone has a desktop browser (text-mode browser, screen scraper), or even a desktop (cellphone, PDA, WAP), or even a monitor (blind, text-to-speech (TTS) devices), to view your page. If you want to limit your audience and increase your maintenance, tables are one way to do it.
If you must use tables to meet your goal, please review the CSS Table Model for some ideas that may help the transition to CSS in the future. Also, as dws mentioned, there is a wealth of information on tables with CGI here as well as searching for tables on SuperSearch.
Good luck, and you know you can find me on ChatterBox if you have questions or need some help designing or critiquing the site. I'm also unemployed and seeking work, so I can help you longer-term as well, if need be. | [reply] |
|
|
The problem with CSS is inconsistent support. Your Plucker and "quick-hack" sites look like junk on OmniWeb, a very popular Mac Browser. So, whatever CSS you're using isn't failing gracefully. Everything's ending up on top of itself.
Like it or not, we're going to be stuck with tables for general layout for quite some time to come, saving CSS for embellishments. If your site can't be read when the CSS is turned off, you don't have a site yet.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
| [reply] |
|
|
Note that carefully constructed CSS-based sites, when viewed without the aid of a stylesheet, will consist of pure content markup and as such be very readable, if a bit stark. My pages work wonderfully in lynx at any rate. If a browser implements CSS only half-heartedly it's broken.
Stop promoting the tables for layout meme. Stop abusing a markup language for tasks it was never designed for. The sooner this madness ends, the better for everyone.
Makeshifts last the longest.
| [reply] |
|
|
Since I do not have a Macintosh system, or any OSX system local to me, I made it look good in the 11 browsers I had at hand, on the three operating systems I had at my disposal (Linux, FreeBSD, and 5 versions of Windows, using Opera/Mozilla/IE on the latter 5).
It looks and feels identical in all of the graphical browsers, falls back to the non-CSS ones (such as Netscape 4, which uses JSSS as you know), and text-mode, cell, PDA devices work as expected.
If someone could donate an m68k machine with the proper environment to test these things on, I'd be glad to make the necessary pokes to make it compatible, but I can't work miracles, sorry.
Have you run OmniWeb through the CSS test suites yet? I just googled and found a few dozen references to bugs in OmniWeb that affect CSS1 and more that affect CSS2 content (my pages are only using CSS1), so I'm not going to admit that my code is at fault here yet.
Lastly, my sites function perfectly when colors, images, css, and all other ornaments are turned off, and they fall back gracefully to those lesser capabilities, including having features to compensate for the colorblind and the blind.
No browser is perfect, but I'm going to have to assert that if it works on 11 browsers on 3 operating systems using 3 platforms, that the one browser that doesn't work, may not necessarily mean that the other 11 are broken.
| [reply] |