Re: [SMARTY] loop
| From: | Monte Ohrt | Date: | Mon, 02 Dec 2002 20:39:13 +0000 |
| Subject: | Re: [SMARTY] loop | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6613@lists.php.net to get a copy of this message | ||
What are you using this for? If this is for an option list dropdown, Try
loading the config from php then assigning the data to the template so
the html_options function can automate that.
myapp.php
---------
$smarty = new Smarty;
$conf = new Config_File;
$option_vals = explode(',',$conf->get('my.cnf',null,'var'));
$smarty->assign('option_vals', $option_vals);
...
mytemplate.tpl
--------------
{html_options values=$option_vals output=$option_vals}
On Sat, 2002-11-30 at 12:42, Nino Katic wrote:
> Is it possible to do foreach loop over values stored in some var in config
> file? So for example i have:
>
> var = label1, label2, label3
>
> and I want do a foreach like this: {foreach from=#var# ....}
>
> One more question..
> I want that same var to contain some string like 'Add some text' and to
> display it on a submit button, but all i get is the first word of a string
> 'Add'? I tried putting string in ' ' but it's the same.
>
> Nino
--
Monte Ohrt <monte@ispi.net>