Re: [phplib] templates: toggling blocks From: Jens Benecke (jens <email protected>)
Date: 04/14/01

On Sat, Apr 14, 2001 at 09:43:36PM +0200, Karsten Dambekalns wrote:
> On Sat, Apr 14, 2001 at 09:29:04PM +0200, Jens Benecke wrote:
>
> > How would I accomplish this with PHPLIBs templates? Is there a cleaner
> > solution than defining a CSS variable as {CSS} and then set_var'ing this
> > over the result-loop? (which would mean that I'm not strictly separating
> > design from code any more, which I dislike)
> What about defining class alt1 and alt2 for the alternating rows
> $class = ($class=="alt1") ? "alt2" : "alt1";
> and then inject that using
> $tpl->set_var("ROWCLASS",$class);

That's what I would probably have ended up doing. It sounds better than I
thought however, now that you suggest it as well :)
 
> You can then define alt1 and alt2 in your stylesheet and give them
> (independent from he code) any look you like. Seems seperated enough to
> me...

You're right, it should be independant enough. Anyway, I don't see a
solution ATM that's definitvely _better_, so I think I'll stick to this.

Thanks. :)

-- 
Jens Benecke                   "Und deshalb sollte man ja auch immer _alle_
                                 Editoren installieren:  XEmacs _und_ Vim."
				                             -- Sven Guckes
http://www.hitchhikers.de/ - Die kostenlose Mitfahrzentrale für ganz Europa

  • application/pgp-signature attachment: stored