|
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 |
dgm Smarty n00b
Joined: 09 Oct 2003 Posts: 2
|
Posted: Thu Oct 09, 2003 7:14 pm Post subject: html_options with OPTGROUPs for cascading menus |
|
|
Hi All!
i'm new to SMARTY but i already love it - great for separating presentation from logic.
i do have a problem however on a short project i'm trying to get done quickly.
i want to make a cascading/heirarchical menu with data from a database but i cannot figure out from the documentation how to set this up (the php & smarty parts not the sql). i've been trying to reconcile the w3c html doc on forms with the smarty manual discussion of html_options
could someone provide a complete but straightforward example of the php & tpl needed to have a browser display cascading menu options like
option1
option2
option3->option3.1
option3.2
option3.3
option4
option5->option5.1
option5.2->option5.2.1
option5.2.2
option6
TIA |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Oct 09, 2003 8:36 pm Post subject: |
|
|
[php:1:556c08ba00]
$opts = array('option1' =>'1',
'option2' =>'2',
'option3' =>'3',
'sub3' => array('option3.1'=>'3.1',
'option3.2'=>'3.2',
'option3.3'=>'3.3'),
'option4' =>'4',
'option5' =>'5',
'sub5' => array('option5.1' =>'5.1',
'option5.2' =>'5.2',
'sub5.2' =>array(
'option5.2.1'=>'5.2.1',
'option5.2.2'=>'5.2.2')),
'option6' =>'6');
$smarty->assign('opts', $opts);
[/php:1:556c08ba00]
Code: | <form>
{html_options name=foo options=$opts}
</form> |
have fun
messju |
|
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
|