Forums / General / Variable exists

Variable exists

Author Message

Carlos Revillo

Thursday 25 May 2006 2:12:34 am

Hi. Is there any way to know if a variable is defined?.

I'll try to explain it better.

I have a node. Path_identification_string for the node is ".../node"

But, sometimes, i have urls like "../node?var=x" and so on.

How can i know if i have params in my url or not?.
I was thinking in something like if is_defined(var) or something like that...

Thanks.

Marcin Drozd

Friday 26 May 2006 3:25:13 am

Hi Carlos

You can use a template operator is_set( target )
where target = ezhttp('var','get');
and var is name of your get variable from url

see more:
http://ez.no/doc/ez_publish/technical_manual/3_7/reference/template_operators/variable_and_type_handling/get_type
http://ez.no/doc/ez_publish/technical_manual/3_7/reference/template_operators/variable_and_type_handling/is_set
http://ez.no/doc/ez_publish/technical_manual/3_7/reference/template_operators/variable_and_type_handling/is_unset

http://ez-publish.pl

kracker (the)

Wednesday 31 January 2007 7:40:34 am

I tried Marcin's approach for testing if a variable exists with this code,

{if is_set( ezhttp( 'print', 'get' ) )}x{else}z{/if}

I also read a similar thread,
<i>http://ez.no/community/forum/general/how_to_test_for_existance_of_variable</i>

Yet this approach seems to throw a this error,

Error: eZTemplate:ezhttp    Jan 31 2007 10:31:16    Unknown get variable 'print'

Is it possible to test for a variable in template language in this way without throwing an error?

//kracker

<i>sage francis - sick of waiting tables - i apologize</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Kristian Hole

Wednesday 31 January 2007 7:46:19 am

Implemented in 3.9:
http://pubsvn.ez.no/viewcvs/ezp/trunk/doc/features/3.9/added_away_to_check_existence_of_var_in_ezini_or_ezhttp.txt?view=markup

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

eZ debug

Timing: Jan 30 2025 21:22:54
Script start
Timing: Jan 30 2025 21:22:54
Module start 'content'
Timing: Jan 30 2025 21:22:54
Module end 'content'
Timing: Jan 30 2025 21:22:54
Script end

Main resources:

Total runtime0.3559 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0091 587.7500370.3203
Module start 'content' 0.00910.0140 958.07031,005.5547
Module end 'content' 0.02310.3327 1,963.62503,893.8750
Script end 0.3558  5,857.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00471.3330200.0002
Check MTime0.00140.3803200.0001
Mysql Total
Database connection0.00090.245310.0009
Mysqli_queries0.250170.27621410.0018
Looping result0.00180.50351390.0000
Template Total0.332393.410.3323
Template load0.00090.244710.0009
Template processing0.331593.133810.3315
Override
Cache load0.00060.173610.0006
Sytem overhead
Fetch class attribute can translate value0.00220.618710.0022
XML
Image XML parsing0.00030.082910.0003
General
dbfile0.00772.1676200.0004
String conversion0.00000.001430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs