Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty 3x -> Defun Recursion Error

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Wed Dec 30, 2009 6:37 am    Post subject: Smarty 3x -> Defun Recursion Error Reply with quote

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 Smile
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Dec 30, 2009 8:27 am    Post subject: Reply with quote

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
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Wed Dec 30, 2009 8:43 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Dec 30, 2009 9:07 am    Post subject: Reply with quote

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
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Wed Dec 30, 2009 9:14 am    Post subject: Reply with quote

I do not understand.
Okay stay until Smarty 2 ...
Thank you for your help.
_________________
Hello all coders from Russia Smile
Back to top
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Tue Jan 12, 2010 8:17 am    Post subject: Reply with quote

Help me Embarassed
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 Smile
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jan 12, 2010 8:38 pm    Post subject: Reply with quote

The {function...} tag did not handle double quotes at the name attribute correctly.

The fix is in the SVN now.
Back to top
View user's profile Send private message
IceFrog
Smarty Rookie


Joined: 16 Dec 2008
Posts: 13

PostPosted: Wed Jan 13, 2010 5:53 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP