Thread: PHP Gaudy print

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Stockbridge,Georgia,USA
    Posts
    1
    Rep Power
    0
    I saw a tutorial on PHP in Devshed around
    Oct of last year which included a snip of
    code which printed out every other line of a table a different color (highlight). Could someone please supply this? I've looked and can't
    find it again...DOOH!

    Thanks
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    $row=0;
    while (whatever)
    {
    $row++;
    if ($row%2)
    {
    $bgcol="#ffffff";
    }else
    {
    $bgcol="#cccccc";
    }
    print "<tr bgcolor=$bgcol>";
    print "<td>foo</td>";
    print "</tr>";
    }
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    3
    Rep Power
    0
    Here's my way of alternating row color, and it's much cheesier than the prior post. But hey, we're all learning, right?

    if ($rows == 1){echo '<tr bordercolor="#000000" bgcolor="#00ccee">';
    $rows =0;}
    else {echo '<tr bordercolor="#000000" bgcolor="ffffff">';
    $rows= 1;}
    ...then I'd iterate through the actual contents of each table cell...
    I just set $rows to 1, then 0, then 1 again, ad infinitum!

    Paul

Similar Threads

  1. permissions after uploading
    By Paul Niessen in forum Perl Programming
    Replies: 3
    Last Post: February 15th, 2004, 05:51 PM
  2. Help with HTML Parsing
    By musashiBRS in forum Python Programming
    Replies: 6
    Last Post: February 13th, 2004, 02:32 AM
  3. Writing to two *.csv files
    By CAR in forum Perl Programming
    Replies: 4
    Last Post: February 7th, 2004, 04:39 PM
  4. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  5. need help with testing non-alphanumeric input
    By pinkipodmini in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 01:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo