Is it possible to undef a varible whis is not defined

Author Message

Jose Mourinho

Sunday 09 September 2007 1:22:43 pm

Hello all

Is it possible to undef a variable which is not defined?
And I have one more question... The function is_set($var) returns true if $var is defined or have value different from ''

10x all

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 21:11:04
Script start
Timing: Jan 18 2025 21:11:04
Module start 'layout'
Timing: Jan 18 2025 21:11:04
Module start 'content'
Timing: Jan 18 2025 21:11:05
Module end 'content'
Timing: Jan 18 2025 21:11:05
Script end

Main resources:

Total runtime1.3779 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00010.0052 588.1406152.6406
Module start 'layout' 0.00520.0031 740.781339.4766
Module start 'content' 0.00841.3681 780.2578644.2813
Module end 'content' 1.37640.0014 1,424.539112.1250
Script end 1.3779  1,436.6641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2613160.0002
Check MTime0.00150.1055160.0001
Mysql Total
Database connection0.00060.045610.0006
Mysqli_queries1.316995.5691670.0197
Looping result0.00080.0587650.0000
Template Total1.348897.920.6744
Template load0.00230.167620.0012
Template processing1.346497.715720.6732
Template load and register function0.00020.013110.0002
states
state_id_array0.00090.063310.0009
state_identifier_array0.00180.133320.0009
Override
Cache load0.00210.1507330.0001
Sytem overhead
Fetch class attribute can translate value0.00140.100740.0003
Fetch class attribute name0.00130.097480.0002
XML
Image XML parsing0.00260.187740.0006
class_abstraction
Instantiating content class attribute0.00000.001280.0000
General
dbfile0.00150.1088290.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs