Re: Two color rows in table inside while iteration
| From: | Ashley Sheridan | Date: | Fri, 30 Apr 2010 18:26:30 +0000 |
| Subject: | Re: Two color rows in table inside while iteration | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304790@lists.php.net to get a copy of this message | ||
On Fri, 2010-04-30 at 13:59 -0400, tedd wrote:
> At 4:37 PM +0200 4/30/10, Jay Ess wrote:
> >Paul M Foster wrote:
> >>+1
> >>
> >>This thread came up before, and tedd's solution was the least complex,
> >>as far as I could tell. I shamelessly stole his code and regularly use
> >>it in my own projects. ;-}
> >>
> >Or if one choose to use Smarty template.
> ><tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
> >
> >http://www.smarty.net/manual/en/language.function.cycle.php
>
> Yeah, like that keeps presentation separate from data while making
> things simpler, right? I don't think so.
>
> Embedding styling attributes in html is simply not following "best practices".
>
> For example, if you have 100 pages of the above embedded code and the
> client says "Hey, let's change the color of that table" -- then you
> are going to have to change 100 pages of code whereas if you followed
> "best practices" then you would change only one rule in css.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com
> http://ancientstones.com
> http://earthstones.com
>
I agree. Inline styles are useful in a few fringe cases, but if you can
avoid them then it's best practice to do so.
Thanks,
Ash
http://www.ashleysheridan.co.uk