Page 1 of 1

template smarty repeat tpl help

Posted: Mon Apr 10, 2006 7:30 am
by uptoeleven
I'm sure there is a really sane and sensible answer to this:

in the bullet menu tpl file there is the following:

{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}

now what I want to do (using the explode menu at http://webtechsig.org/Presentations/css/menus/) is:

{if $node->depth > $node->prevdepth}
{repeat string="id')\">$node->menutext" times=$node->depth-$node->prevdepth}

Now that's not going to work because all that is being defined is a string (prior to run-time) so naturally the repeated string will take the value:

id')\">Object->menutext

This isn't entirely useful. I'd like it to be spitting out something like

SHOUTING IS GOOD - eg. the evaluation of $node->id and $node->menutext rather than the fact that they are, indeed, objects... which is useful to know, just not in this context...

Is there a (sane and not coding on crack) way of doing this or am I barking up the wrong dog?

Re: [solved] template smarty repeat tpl help

Posted: Wed Nov 28, 2007 6:15 pm
by ge0
Whilst looking for a solution for the same problem I found this post.  In the end I used an assign to get the right value before the {repeat}...  Hope someone find this of use.

{assign var='ul' value=$node->id}
{repeat string="" times=$node->depth-$node->prevdepth}
...


Cheers

George