Re: [SMARTY] html_options 2.2x vs 2.5.0
| From: | messju mohr | Date: | Sat, 24 Jan 2004 17:18:38 +0000 |
| Subject: | Re: [SMARTY] html_options 2.2x vs 2.5.0 | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10873@lists.php.net to get a copy of this message | ||
On Sat, Jan 24, 2004 at 04:43:01PM +0100, Christian Schloh wrote:
> messju mohr wrote:
> >how does your {html_options}-statement look? did you check if the
> >values you assigned are correct?
>
> smarty-2.6.0 says:
>
> <select name=customer_id>
> {html_options options=$customer_options selected=$customer_id}
> </select>
>
> so i did:
> the data ist in an array, which is generated from a database :
>
> if ($read->db_query('SELECT id, name FROM '.DB_TBL )
> {
> while ($read->get_data()) $opt[$read->id] = $read->name;
> }
> $tpl->assign('options', do_select_db());
>
> template:
>
> <select name="db_name">
> {html_options options=$db_options}
> </select>
>
your value is in $opt, but you assign the value of do_select_db().
the name you assign is "options" but you use "db_options" in the
template.
look in the smarty debug-console if $db_options is assigned
correctly. if it's correct, then the code you posted should work
seemlessly with 2.2.0 and 2.5.0 and 2.6.0.
of course you have to clear the templates_c-folder everytime you
switch versions of smarty (the compiled-templates may not be
compatible) and you should disable caching when testing should things.
> i don't get it what is wrong. seems exactly like described in the docs.
>
> i was looking for some "readme"-files for updates 2.2->2.5/2.6
> explaining what crucial changes there are in templates and code.
the NEWS file in the distributions contains notes about all changes
for each version.
> thanks for your support.
>
> christian