Re: Couple of beginner questions

From: Date: Mon, 12 Jan 2009 21:02:00 +0000
Subject: Re: Couple of beginner questions
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-286148@lists.php.net to get a copy of this message
At 7:47 PM +0000 1/12/09, Ashley Sheridan wrote:
Ehat's what I do do, but the 'odd' has to come from PHP, as unfortunately, numerical selectors in CSS aren't supported by (AFAIK) any browsers at the moment. So for example, if I was coding for alternate rows in a table, I might do: for($i=0; $i<$some_limit; $i++) {
    $rowClass = ($i % 2 == 0)?'':'class="alternate"';
    print <<<EOP
    <tr $rowClass>
        <td>...</td>
        <td>...</td>
        <td>...</td>
    </tr>
EOP; } As far as such loops go, is this a particular faux pas in regards to the way it's coded? Go on Tedd ;) Ash
True, css does not allow numeric classes (like sessions). But, I never need them anyway. As I provided before: http://webbytedd.com/b/color-rows/ this is my solution for alternating row style. As for the above code being something I approve, or not -- I see your point. Heredoc's do present a mixture of text (HTML, et all.) that begs the question of IF it is keeping html and php separate. On one hand, some can say that a heredoc IS a component as much as echo() and thus should not contain html. But on the other hand, that's what it was designed for. So, it's one of those things that can't be judged in such fashion. However, I can say that a heredoc containing html does not brother me as much as an echo() containing the same. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#286148) next »