Share » Forums » Developer » Is it possible to undef a varible...

Is it possible to undef a varible whis is not defined

Is it possible to undef a varible whis is not defined

Sunday 09 September 2007 1:22:43 pm - 4 replies

Author Message

André R.

Sunday 09 September 2007 1:31:13 pm

Why would you want to undefine a variable that is not defined??
Are you talking about undefine a variable if it is defined? like this:

{if is_set( $my_var )}
{undef $my_var}
{/if}

is_set:
http://ez.no/doc/ez_publish/technical_manual/3_9/reference/template_operators/variable_and_type_handling/is_set

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Jose Mourinho

Sunday 09 September 2007 2:19:49 pm

Yes I want to do this but in the example at
http://ez.no/doc/ez_publish/techn...rs/variable_and_type_handling/is_set

{def $whatever='We need more rocket fuel!'}
{if is_set( $whatever )}
It is set.
{else}
It is not set.
{/if}

but $whatever has a value ...
I want to know if the variable is defined. I don't want to know if variable has some value ...

Felix Laate

Sunday 09 September 2007 2:54:37 pm

But this is the excact function of the is_set operator, after all the doc reads:

Returns TRUE if the value of the provided variable is set.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Peter Putzer

Sunday 09 September 2007 3:53:34 pm

Unfortunately, is_set() returns false if the value of the inspected variable is false. For most common applications (checking whether a variable is set before either using its value or a default), first_set() is the proper workaround.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

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

36 542 Users on board!

Forums menu