|
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 |
ricklach Smarty Regular
Joined: 27 Aug 2004 Posts: 39
|
Posted: Tue Jan 25, 2005 12:14 am Post subject: array and checkboxes |
|
|
I have a $result array(associative) that is always a single row with a number and a series of "y" or "n" in the colums. How do I pass that array to a template - is it as simple as $smarty->assign("result", $result) and in the template how do I get at the values (eg. {$result.nameofcolum}???) so that I can assign them to checkboxes so that "Y" = checked.
Rick |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Jan 25, 2005 12:42 am Post subject: |
|
|
Yes, you can simply assign the array to Smarty as you suggest. As long as your array is acceptable to html_checkboxes. your life should be easy. It sounds like the following would work:
Code: | {foreach from=$result item=checkboxes key=group}
{$group} : {html_checkboxes options=$checkboxes}
{/foreach}
|
|
|
Back to top |
|
ricklach Smarty Regular
Joined: 27 Aug 2004 Posts: 39
|
Posted: Tue Jan 25, 2005 1:16 am Post subject: |
|
|
Boots,
Thanks for that. I learned something new again today.
Rick |
|
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
|