View previous topic :: View next topic |
Author |
Message |
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Wed Dec 30, 2009 6:37 am Post subject: Smarty 3x -> Defun Recursion Error |
|
|
Hello, i'm update my smarty libs => 3x series
But now i have troubles with compiller.defun
Thats critical bug for me.
Plz fix, or update Smarty 3x series.
----
Thx. _________________ Hello all coders from Russia |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Dec 30, 2009 8:27 am Post subject: |
|
|
Some of the plugins contributed to the Smarty2 Wiki make use of Sarty2 internals which are not compatible with Smarty3. This is the case for the defun plugin.
But Smarty3 has same functionallity as defun build in.
See the description of the {function} tag in the README. |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Wed Dec 30, 2009 8:43 am Post subject: |
|
|
This code build treemenu:
Code: | <ul id="aside">{defun name="menurecursion" list=$menu}
{foreach from=$list item=element}
{if !empty($element.children)}
<li id="{$element.id}">
<div class="maincat"><a href="#">{$element.title}</a></div>
{else}<li>{$element.title}
{/if}
{if !empty($element.children)}
<ul>{fun name="menurecursion" list=$element.children}</ul>
{/if}
</li>
{/foreach} |
It's example treemenu from other subject this forum community.
Help me rebuild above my code on smarty 3x.
Thx so match _________________ Hello all coders from Russia |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Dec 30, 2009 9:07 am Post subject: |
|
|
Code: | <ul id="aside">{function name="menurecursion" list=$menu}
{foreach from=$list item=element}
{if !empty($element.children)}
<li id="{$element.id}">
<div class="maincat"><a href="#">{$element.title}</a></div>
{else}<li>{$element.title}
{/if}
{if !empty($element.children)}
<ul>{menurecursion list=$element.children}</ul>
{/if}
</li>
{/foreach}
{/function}
//called by
{menurecursion}
or
{menurecursion list=$mymenu}
|
|
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Wed Dec 30, 2009 9:14 am Post subject: |
|
|
I do not understand.
Okay stay until Smarty 2 ...
Thank you for your help. _________________ Hello all coders from Russia |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Tue Jan 12, 2010 8:17 am Post subject: |
|
|
Help me
U.Tews wrote: | Code: | <ul id="aside">{function name="menurecursion" list=$menu}
{foreach from=$list item=element}
{if !empty($element.children)}
<li id="{$element.id}">
<div class="maincat"><a href="#">{$element.title}</a></div>
{else}<li>{$element.title}
{/if}
{if !empty($element.children)}
<ul>{menurecursion list=$element.children}</ul>
{/if}
</li>
{/foreach}
{/function}
|
|
this example does not work.
Code: | <ul>{menurecursion list=$element.children}</ul>" unknown tag "menurecursion"' |
------------------------------
My Old Template:
Code: |
<ul id="aside">{defun name="menurecursion" list=$menu}
{foreach from=$list item=element}
{if !empty($element.children)}
<li id="{$element.id}">
<div class="maincat"><a href="#">{$element.title}</a></div>
{else}<li><a href="#URL#/demo/{$element.title_seo}/viewcat:{$element.id}/">
{if $pshopdata.category.id == $element.id}<strong>{$element.title}</strong>
{else}{$element.title}{/if}
</a>
{/if}
{if !empty($element.children)}
<ul>{fun name="menurecursion" list=$element.children}</ul>
{/if}
</li>
{/foreach}
{/defun}
</ul>
|
_________________ Hello all coders from Russia |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jan 12, 2010 8:38 pm Post subject: |
|
|
The {function...} tag did not handle double quotes at the name attribute correctly.
The fix is in the SVN now. |
|
Back to top |
|
IceFrog Smarty Rookie
Joined: 16 Dec 2008 Posts: 13
|
Posted: Wed Jan 13, 2010 5:53 am Post subject: |
|
|
U.Tews wrote: | The {function...} tag did not handle double quotes at the name attribute correctly.
The fix is in the SVN now. |
U.Tews Thank you for the update in SVN.
But the function can not be called in double quotes. (ex:{menurecursion})
I'm fix example, clear double quotes and now it work. _________________ Hello all coders from Russia |
|
Back to top |
|
|