Forums / General / Can't override my variable

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Can't override my variable

Author Message

Philip K.

Monday 02 January 2006 3:51:25 am

Hey.

I've defined a variable in my tpl file

{def $str=""}

When I want to override this variable with

{set $str="my value"}

or

{set $str=$myvalue}

it doesn't work. There is no override and the $str is still empty... Is there anyone who has any idea why I can't override the variable?

Linux is like a wigwam; no windows, now gates, and apache inside!

Philip K.

Monday 02 January 2006 9:07:13 am

OK, I found the Problem - or a Bug.....?!

I used the following code:

{def $str=""}

{switch name=myname match=$node.node_id}
  {case in=array('xx','xx','xx')}
    
    do this

  {/case}
  {case}

    {set $str=$str|append("myvalue")}

  {/case}
{/switch}

and whenever I tried to change die value of $str nothing happened. Later I tried anything to find a mistake in my code an the mistake was, that I mustn't give a name to the "Switch".

Now I have this code:

{def $str=""}

{switch match=$node.node_id}
  {case in=array('xx','xx','xx')}
    
    do this

  {/case}
  {case}

    {set $str=$str|append("myvalue")}

  {/case}
{/switch}

and it works fine :)

But isn't it a bug?? I don't know...

Linux is like a wigwam; no windows, now gates, and apache inside!