user defined tags passing array to template.

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
spyro

user defined tags passing array to template.

Post 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.
spyro

Re: user defined tags passing array to template.

Post 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
sloop

Re: user defined tags passing array to template.

Post by sloop »

spyro,

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

-sloop
Post Reply

Return to “Developers Discussion”