Share » Forums » Developer » Best practice when dealing with...

Best practice when dealing with session variables?

Best practice when dealing with session variables?

Tuesday 25 January 2011 7:28:11 am - 2 replies

Author Message

Gaetano Giunta

Tuesday 25 January 2011 8:33:30 am

It's verbose but correct

Principal Consultant International Business
Member of the Community Project Board

Franck Magnan

Tuesday 25 January 2011 11:48:09 am

Hello Helge,
in your second example, error is throwing any way.
To avoid it, you can use this syntax:

{def $my_var=false()}
   {if ezhttp_hasvariable( 'my_session_var', 'session' )}
      {set $my_var=ezhttp( 'my_session_var', 'session' )}
   {if}
{undef $my_var}

or, if you prefer have it in one line:

{def $my_var=cond(ezhttp_hasvariable( 'my_session_var', 'session' ), ezhttp( 'my_session_var', 'session' ), false())}

--
Developer at Open Wide

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu