Re: [SMARTY] Method Request

From: Date: Thu, 20 Feb 2003 19:44:24 +0000
Subject: Re: [SMARTY] Method Request
References: 1 2 3 4 5 6 7 8  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8039@lists.php.net to get a copy of this message
We already have get_template_vars() that just returns a reference to the entire array. I wonder if we could expand that. example: $smarty->get_template_vars('varname'); $smarty->get_template_vars('varname','config'); The first one gets the value of assigned var "varname", the second gets the value of assigned config file var "varname". Not a perfect method name, but at least this keeps the number of methods to a minimum by reusing it. Monte On Thu, 2003-02-20 at 13:36, Paul Lockaby wrote: > Monte Ohrt wrote: > > In my case, I keep this kind of stuff in config files, but in hidden > > sections: > > > > [.database] > > dbhost = db-host > > dbname = foo > > dbuser = joe > > dbpass = blah > > > > Hidden sections can NOT be loaded into the templates, so I load up a > > separate instance of the Config_File class and get the vars directly > > from the config files. > > > > In some cases (like above), loading the vars into the templates is an > > unnecessary step, unless you want to access vars that will get assigned > > anyways. Typically you don't want things like database config info > > accessible from within the templates! > > > > Thoughts? > > > > Yeah... that is an interesting point. Likewise, though I never > mentioned, I do keep my database variables in a hidden section, so they > would have to be loaded manually. But can we atleast get the variables > that are loaded into the template also into the script? > > ~Paul -- Monte Ohrt <monte@ispi.net>

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