Forums / Developer / Best practice for handling keys in $view_parameters

Best practice for handling keys in $view_parameters

Author Message

Lars Eirik R

Friday 06 May 2011 2:02:29 am

Hi. I need to check if my $view_parameters contains a given key. What is the best approach for doing this without getting any warnings in my log.

Could someone verify that is_set is the right way? seems to work

Ivo Lukac

Friday 06 May 2011 2:50:14 am

Yes:

{if is_set($view_parameters.foo)}

{/if}

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

eZ debug

Timing: Jan 29 2025 13:45:23
Script start
Timing: Jan 29 2025 13:45:23
Module start 'content'
Timing: Jan 29 2025 13:45:23
Module end 'content'
Timing: Jan 29 2025 13:45:23
Script end

Main resources:

Total runtime0.0124 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.4141180.8203
Module start 'content' 0.00560.0038 770.234493.8516
Module end 'content' 0.00940.0029 864.085970.6875
Script end 0.0124  934.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002217.9949120.0002
Check MTime0.00108.0464120.0001
Mysql Total
Database connection0.00075.892710.0007
Mysqli_queries0.002015.741540.0005
Looping result0.00000.136320.0000
Template Total0.002620.910.0026
Template load0.00065.055910.0006
Template processing0.002015.852810.0020
Override
Cache load0.00043.574010.0004
General
dbfile0.00021.8676100.0000
String conversion0.00000.038430.0000
Note: percentages do not add up to 100% because some accumulators overlap

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