Re: Couple of beginner questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux