UDT in another Tag

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jobmoving
New Member
New Member
Posts: 7
Joined: Tue May 10, 2011 9:20 pm

UDT in another Tag

Post 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
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: UDT in another Tag

Post 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
winkelman
Forum Members
Forum Members
Posts: 32
Joined: Sun Dec 19, 2010 9:05 pm

Re: UDT in another Tag

Post 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}
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: UDT in another Tag

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

Return to “Modules/Add-Ons”