Re: [SMARTY] Using Smarty for Dynamic CSS
| From: | Monte Ohrt | Date: | Fri, 03 May 2002 14:51:45 +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-4032@lists.php.net to get a copy of this message | ||
Performance won't make any noticable difference, especially if you use any caching. It is more a matter of preference, either looks like it will work (except the #$foo# syntax, you'll need a custom function to get that)
Monte
MPN wrote:
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-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.