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?
Can Smarty be used in a User Defined Tag (UDT) (SOLVED!)
Can Smarty be used in a User Defined Tag (UDT) (SOLVED!)
Last edited by jmcgin51 on Fri May 16, 2008 7:48 pm, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Can Smarty be used in a User Defined Tag (UDT)
copy the logic into a Global content block
and then just insert the global content block into each of your templates.
UDT's are PHP code, GCB's are smarty.
and then just insert the global content block into each of your templates.
UDT's are PHP code, GCB's are smarty.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Can Smarty be used in a User Defined Tag (UDT)
thank you! If I get a chance, I'll add that to the Wiki. I looked all over the forum and documentation, and didn't really see it stated as clearly as you just did.
off to create a GCB...
off to create a GCB...
