Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 22nd, 2004, 2:40 PM   #1
dan@george
Newbie
 
Join Date: Jun 2004
Location: Middletown, CT
Posts: 3
Rep Power: 0 dan@george is on a distinguished road
Send a message via AIM to dan@george
I'm not sure whether this should go in the Perl or HTML forum, but here goes:

In an attempt to make this CGI page in perl more W3C- and future-compliant, I've just finished converting it into XHTML 1.0 strict and CSS, fully validated by the W3C's validator. (That's actually a static copy of the page's output, not the CGI script, but it should be enough to give the general idea.) Anyway, I've heard that tables are going to be phased out eventually, and that it's a good idea to replace tables with CSS notation and <div> sections. I did this for the basic layout of the page, but here's the problem:

The list on the left side of the screen is a table generated dynamically by the CGI script. It parses a text file for its data and creates the table. Here's the code for that part of the script.
print <<EOS;
<div id='buddy-list'>
    <table class="subtable">
    <tr><td>BUDDY</td><td style='width:60px'>LINES</td></tr>
EOS

open(AIMCOUNT,'/DocumentRoot/aimcount.txt');
$i=1;
while($line = <AIMCOUNT>) {
    ($numlines,$screenname) = split('&',"$line");
    chomp($screenname);
    if($i / 2 == int($i / 2)) {
        $cellformat = ' class=\'altrow\'';
    } else {
        $cellformat = '';
    }
    print("\<tr$cellformat\><td\>");
    print("$screenname");
    print("\<\/td\>\<td style='text-align: right'\>");
    print("$numlines");
    print("\<\/td\>\<\/tr\>\n");
    $i++;
}
close(AIMCOUNT);
I can't think of any way to do this without tables -- is anybody familiar with any techniques I could use?
__________________
Remember: no matter what odds you're up against, or how many times you've tried already, it can't hurt to SPAWN MORE OVERLORDS.
dan@george is offline   Reply With Quote
Old Aug 23rd, 2004, 3:13 AM   #2
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
As far as i no they are not phasing out tables, its just people who want teh oh so great look at me and my design that are. They provide a bit more flaxibility design by CSS, bu tables will be there for data layout always as it is the most proctical way to do it.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Aug 24th, 2004, 12:07 PM   #3
sarumont
Hobbyist Programmer
 
sarumont's Avatar
 
Join Date: Apr 2004
Location: /dev/urandom
Posts: 154
Rep Power: 5 sarumont is on a distinguished road
Send a message via ICQ to sarumont Send a message via AIM to sarumont Send a message via Yahoo to sarumont
You could use <div>'s to replace tables, though. I'm not sure how easy it would be (I'm not brushed up on the position attributes that you would use), but I'm sure that it can be done if you still want to go through with it.
__________________
"Time is an illusion. Lunchtime doubly so."
-the late, great Douglas Adams
sarumont is offline   Reply With Quote
Old Sep 28th, 2004, 8:18 AM   #4
scorpiosage
Programmer
 
scorpiosage's Avatar
 
Join Date: Aug 2004
Location: Austin, Tx
Posts: 55
Rep Power: 5 scorpiosage is on a distinguished road
Send a message via AIM to scorpiosage Send a message via Yahoo to scorpiosage
Sarumont is absolutely right here.
If you are realy desperate to get rid of the tables, you can use the <div> tag, and use pixle shims to get around using them. But, at no time in the future, that I can see are tables going to be obsolete here.

However, if you did want to get really fancy with it all, you could get into Javascript or vbscript to create your tables. but I honestly wouldn't even go that far.

Your code here looks correct, and I am assuming that it works on your site. If it isn't broke, don't fix it, as they say.

Hope this helps you
Mike
__________________
Here's my latest project still in the works, and I need to get rid of this &quot;frame&quot; situation for real. www.prideofaustin.com
scorpiosage is offline   Reply With Quote
Old Sep 28th, 2004, 12:37 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Check this out - it shows you how to use the <div> tags together with the float attribute:

http://www.yourhtmlsource.com/styles...csslayout.html
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC