Page 1 of 1

user defined tags passing array to template.

Posted: Wed Mar 08, 2006 5:28 pm
by spyro
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.

Posted: Thu Mar 09, 2006 4:08 am
by spyro
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

Re: user defined tags passing array to template.

Posted: Thu Mar 09, 2006 2:22 pm
by sloop
spyro,

thanks for posting this - i was looking for something similar, this helped, thanks!

-sloop