|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ca215 Smarty n00b
Joined: 28 Aug 2003 Posts: 2
|
Posted: Thu Aug 28, 2003 5:04 pm Post subject: functions in config files? |
|
|
Hi people,
I have a website where I have defined some styles in a config file. They are variables which contain "style=...". What I would like is some way to parameterize these styles, for example I would say {#style_paragraph|align=left#}. Or {#style_paragraph# align=left}, that would require a function defined in the config file. Is this possible to do?
I found a way to do this using the replace modifier, but that is a bit complicated, and you can't set default values. Like saying {#style_paragraph#|replace:"$align":"left"} or something like that.
Any advice is appreciated. Thank you:
Adam |
|
Back to top |
|
ca215 Smarty n00b
Joined: 28 Aug 2003 Posts: 2
|
Posted: Thu Aug 28, 2003 6:13 pm Post subject: |
|
|
I just thought of a possible solution: forget smarty, and use style sheets. Then if I need to change a style somewhere I just use an inline style definition, instead of using parameters. Any comments? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Aug 28, 2003 6:43 pm Post subject: |
|
|
I think that CSS should be used wherever possible
You can even use Smarty to generate CSS sheets dynamically, if you wish to do that. For example, I have a style sheet with both a clean and a flashy style. They are identical except for some background images and colors. So passing a parameter to the css, I can use a single template to produce both stylesheets. Makes layout and other updates easier since it is all maintained in a single place. Smarty can even be directed to cache multiple versions. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|