RE: [SMARTY] Using Smarty for Dynamic CSS

From: Date: Sat, 04 May 2002 02:27:29 +0000
Subject: RE: [SMARTY] Using Smarty for Dynamic CSS
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4049@lists.php.net to get a copy of this message
Could you expand on this Monte. Thanks. -----Original Message----- From: Monte Ohrt [mailto:monte@ispi.net] Sent: Friday, May 03, 2002 7:54 AM To: Sven Axelsson Cc: smarty-general@lists.php.net; mpn@3dgamelink.com Subject: Re: [SMARTY] Using Smarty for Dynamic CSS In our experience, we found that trying to make style sheets dynamic with Smarty ended up being overkill. We just include static .css files and keep them maintained just like any smarty .tpl file. Monte Sven Axelsson wrote: > Isn't the whole point with CSS that you don't change the style > selectors, you change the style definitions? Of course you can > do it like you say below, but wouldn't it be better to dynamically > generate the definitions like: > > <style> > {$p_news} > {$p_whatever} > </style> > > and just use the selectors directly in your html? > > /sven axelsson > > >>-----Original Message----- >>From: MPN [mailto:mpn@3dgamelink.com] >>Sent: den 3 maj 2002 16:34 >>To: smarty-general@lists.php.net >>Subject: RE: [SMARTY] Using Smarty for Dynamic CSS >> >> >>Thanks for the replies. :) >> >>I was thinking more along the lines of changing selectors >>within the body of the template. Say for instance, you give >>the user the option to change paragraph text size, and >>somewhere in your CSS you have something like p.news1 >>{text-size: 1.0em; }... p.news5 {text-size: 1.5em; }. Then >>based on the user selection, the appropriate class selector >>is inserted into the template either by comparing a list of >>possible values from a config file, or by passing the >>variable directly to the template. >> >>Example: >> >> <p.{$paraopt}>Blah blah</p> {* This assumes the entire >>selector is passed *} >> >>OR >> >> <p.{#$paraopt#}>Blah blah</p> {* Where $paraopt is a >>simple identifier (a1, a2, ...) and the config file holds the >>actual CSS selector choices (news1, news2...) *} >> >> >> >>So the question is, what would be more efficient in terms of >>performance and code?? >> >>KT >> >> >>-----Original Message----- >>From: Alan McFarlane [mailto:amcfarlane@bigfoot.com] >>Sent: Friday, May 03, 2002 6:20 AM >>To: mpn@3dgamelink.com; smarty-general@lists.php.net >>Subject: RE: [SMARTY] Using Smarty for Dynamic CSS >> >> >>Yup >> >>I use the following code: >> >> -- index.php -- >> ... >> $tpl->assign("style", "default"); >> ... >> >> -- index.tpl -- >> ... >> <link rel="stylesheet" type="text/css" >>href="./styles/{$style}.css" /> >> ... >> >> >>-----Original Message----- >>From: MPN [mailto:mpn@3dgamelink.com] >>Sent: 03 May 2002 04:02 >>To: smarty-general@lists.php.net >>Subject: [SMARTY] Using Smarty for Dynamic CSS >> >> >>Has anyone explored the possibility of using smarty for >>dynamically changing CSS selectors? >> >>KT >> >> >>-- >>Smarty General Mailing List (http://smarty.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> >>-- >>Smarty General Mailing List (http://smarty.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> > > -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#4049) next »