Page 1 of 1

UDT in another Tag

Posted: Wed Jun 29, 2011 1:36 pm
by jobmoving
Hello you,

I've got a User Defined Tag thats called {category_get}, it gets a category name like "Shirts".
Now i've got a tag from Products wich is {Products category={category_get} }

How can i make this work, because apparently you can't put 2 Tags within eachother.
Do you got a solution for this problem?

Gr. Job

Re: UDT in another Tag

Posted: Wed Jun 29, 2011 7:17 pm
by Jos
You can use the smarty function capture:
http://www.smarty.net/docsv2/en/languag ... on.capture

Another way is to edit your UDT a little, to let it pass a smarty variable to your page. See the bottom of this page for an example:
http://wiki.cmsmadesimple.org/index.php ... fined_Tags

Re: UDT in another Tag

Posted: Thu Jun 30, 2011 10:40 am
by winkelman
jobmoving wrote: I've got a User Defined Tag thats called {category_get}, it gets a category name like "Shirts".
Now i've got a tag from Products wich is {Products category={category_get} }
Modify your udt and output the udt values to a smarty variable

http://www.smarty.net/docsv2/en/api.assign.tpl

so you can use something like

Code: Select all

{category_get}
{Products category=$category_get_var}

Re: UDT in another Tag

Posted: Thu Jun 30, 2011 4:08 pm
by Wishbone
... or more cleanly, pass the variable name to the UDT.

The smarty call:
{category_get assign=categories}
{Products category=$categories}
In the UDT:
$smarty->assign($params['assign'], $category_data);
..assuming that $category_data contains the return info in the UDT.