|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
radecek Smarty n00b
Joined: 05 May 2010 Posts: 1
|
Posted: Wed May 05, 2010 7:23 am Post subject: Name of option as associative array |
|
|
Hi,
I need make form with many options ({html_options..}). Each options have name and index, becouse I load and save data throw database. But I have problem with name and index. I cant use:
Code: | {html_options name=d[type][$s.optionName] options=$s.sponsorType selected=$s.type}
|
When I use name='d[type][$s.optionName]' name of element is d[type][$s.optionName]. $s.optionName isnt var, but string.
Name of element must be: d[type][abcdefgh].
Index of d[type][abcdefgh] isnt number but sha1 code.
Do you know haw can I solve this problem? I have temporary and bad solutions:
php:
Code: |
$smarty->assign("sponsor", "type[".$logoSha1."]");
|
template:
Code: |
{html_options name=$sponsor ...}
|
Thx for reply |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed May 05, 2010 1:55 pm Post subject: |
|
|
Code: | {html_options name="d[type][`$s.optionName`]" options=$s.sponsorType selected=$s.type} |
or:
Code: | <select name="d[type][{$s.optionName}]">
{html_options options=$s.sponsorType selected=$s.type}
</select> |
|
|
Back to top |
|
topwzp Guest
|
Posted: Mon Jun 07, 2010 8:16 am Post subject: |
|
|
Good one dude..keep doing nice work |
|
Back to top |
|
|
|
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
|