Can Smarty be used in a User Defined Tag (UDT) (SOLVED!)
Posted: Fri May 16, 2008 6:29 pm
Can Smarty be included in a UDT? When I try to include Smarty in a UDT, I get the following error:
* Invalid code entered.
* Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in
\\mypath\adduserplugin.php(94) : eval()'d code on line 1
I found this in the documentation: http://wiki.cmsmadesimple.org/index.php ... _.28UDT.29
but I don't understand how to implement it, or if it can be used in my situation.
Here's my situation. I have a site where I'm using FEU and CC to provide different content to different users. I'm also using the excludeprefix and includeprefix parameters for my menus so that the nav menu also shows different tabs for different users. Everything works fine, but I currently have to include all my menu logic in EACH page template, like this:
{menu template='simple_navigation.tpl' collapse='1'}
{elseif $customcontent_memberof_group1 > 0}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group2_"}
{elseif $customcontent_memberof_group2 > 0}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group1_"}
{else}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group1_,group2"}
{/if}
Since I have several templates, this means quite a bit of editing any time I need to change this logic (new groups, etc.)
I'd like to create a UDT with the menu logic, and just call that UDT at the appropriate place in my template. Then, if I need to change groups or logic, I just edit one UDT instead of multiple templates.
How can this be done?
* Invalid code entered.
* Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in
\\mypath\adduserplugin.php(94) : eval()'d code on line 1
I found this in the documentation: http://wiki.cmsmadesimple.org/index.php ... _.28UDT.29
but I don't understand how to implement it, or if it can be used in my situation.
Here's my situation. I have a site where I'm using FEU and CC to provide different content to different users. I'm also using the excludeprefix and includeprefix parameters for my menus so that the nav menu also shows different tabs for different users. Everything works fine, but I currently have to include all my menu logic in EACH page template, like this:
{menu template='simple_navigation.tpl' collapse='1'}
{elseif $customcontent_memberof_group1 > 0}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group2_"}
{elseif $customcontent_memberof_group2 > 0}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group1_"}
{else}
{menu template='simple_navigation.tpl' collapse='1' excludeprefix="group1_,group2"}
{/if}
Since I have several templates, this means quite a bit of editing any time I need to change this logic (new groups, etc.)
I'd like to create a UDT with the menu logic, and just call that UDT at the appropriate place in my template. Then, if I need to change groups or logic, I just edit one UDT instead of multiple templates.
How can this be done?