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

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 11:25:09
Script start
Timing: Jan 18 2025 11:25:09
Module start 'layout'
Timing: Jan 18 2025 11:25:09
Module start 'content'
Timing: Jan 18 2025 11:25:09
Module end 'content'
Timing: Jan 18 2025 11:25:09
Script end

Main resources:

Total runtime0.0162 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.9141152.6094
Module start 'layout' 0.00580.0036 741.523439.3984
Module start 'content' 0.00940.0047 780.921993.3828
Module end 'content' 0.01410.0021 874.304734.3047
Script end 0.0162  908.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.4271140.0002
Check MTime0.00116.9196140.0001
Mysql Total
Database connection0.00084.647810.0008
Mysqli_queries0.002615.861530.0009
Looping result0.00000.154110.0000
Template Total0.001710.510.0017
Template load0.00095.403610.0009
Template processing0.00085.035210.0008
Override
Cache load0.00063.859710.0006
General
dbfile0.00031.558680.0000
String conversion0.00000.070440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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