user defined tags passing array to template.
user defined tags passing array to template.
Is there are a way to pass a smarty array to the page/template from a user defined tag? Bascally I want to get/set/process data via UDT and pass any data for display to the page to be displayed via smarty logic.
Re: user defined tags passing array to template.
Ok, I'm getting the hang of it. I can create a smarty array in and userdefined tag and use it in the page template. Pretty slick.
example...
udt:
$list = array('Books', 'Are', 'Fun');
$smarty->assign("list", $list);
page:
{test} Iteration {$list}
{sectionelse}
Array $list has no entries
{/section}
output:
Iteration Books
Iteration Are
Iteration Fun
example...
udt:
$list = array('Books', 'Are', 'Fun');
$smarty->assign("list", $list);
page:
{test} Iteration {$list}
{sectionelse}
Array $list has no entries
{/section}
output:
Iteration Books
Iteration Are
Iteration Fun
Re: user defined tags passing array to template.
spyro,
thanks for posting this - i was looking for something similar, this helped, thanks!
-sloop
thanks for posting this - i was looking for something similar, this helped, thanks!
-sloop