Re: [SMARTY] Using config files
| From: | Chris Hubbard | Date: | Thu, 10 Mar 2005 06:16:49 +0000 |
| Subject: | Re: [SMARTY] Using config files | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12312@lists.php.net to get a copy of this message | ||
Reynier,
It's easy to use the config file. You can store almost anything you want in there.
Personally I wouldn't store CSS definitions in the config file, though I suppose you could. If you need to be able to have dynamically loaded CSS files, you could have the name of the CSS file in the config file.
As far as the sections go, use the sections to load a subset of the config. As far as I can tell the section don't affect the #vars# array as displayed in the debug window.
It doesn't seem to matter what the name of the config file is, as long as you reference it correctly in the config_load.
Don't know why you're having problems with $smarty.now. Are you passing it through the date formatter?
{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
Hope this is helpful,
Chris
On Mar 9, 2005, at 8:57 PM, Reynier Pérez Mira wrote:
Well comunity: I need to use a config files, but I have some questions about it. For example 1. I can substitute .css file by a config file? 2. When I create a conf file with wich extension I will save? 3. How I know to wich section belongs de [var]? Look a example I found in Smarty Manual: pageTitle = "Main Page" bodyBgColor = #000000 tableBgColor = #FFFFFF [Customer] pageTitle = "Customer Infor" [Login] pageTitle = "Login Page" focus = "username" # hidden section [.Database] host = myhost.com db = database user = username pass = userpass In this case use [Customer] && [Login] && [.Database] How I know wich I can use depending the page I stay. The other problem is that I tried to use the $smarty.now function and the page return me an error. How can I use predefined functions come from Smarty? Regards Reynier Pérez Mira ---------------------------------