Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

functions in config files?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
ca215
Smarty n00b


Joined: 28 Aug 2003
Posts: 2

PostPosted: Thu Aug 28, 2003 5:04 pm    Post subject: functions in config files? Reply with quote

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
View user's profile Send private message
ca215
Smarty n00b


Joined: 28 Aug 2003
Posts: 2

PostPosted: Thu Aug 28, 2003 6:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Aug 28, 2003 6:43 pm    Post subject: Reply with quote

I think that CSS should be used wherever possible Smile

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP