view_parameters question for tab navigation

Author Message

Daniele Nocentini

Wednesday 22 March 2006 2:10:48 am

I've made a tab navigation with view_parameters variable pass in the url, this is my code:

{switch match=$view_parameters.tab}
	{case match=1}
		{def $tab1='class="active"'}
		{def $tab2=''}
		{def $tab3=''}
	{/case}
	{case match=2}
		{def $tab1=''}
		{def $tab2='class="active"'}
		{def $tab3=''}
	{/case}
	{case match=3}
		{def $tab1=''}
		{def $tab2=''}
		{def $tab3='class="active"'}
	{/case}
	{case}
		{def $tab1='class="active"'}
		{def $tab2=''}
		{def $tab3=''}
	{/case}
{/switch}

When click on a tab I pass to $view_parameters.tab the number of the tab I want to view , but in the first time $view_parameters.tab is empty and the debug show me this error:

Error: eZTemplate @ design/tlf_ita/override/templates/full/product.tpl:3[0] Mar 22 2006 11:13:07

No such attribute for array(4): tab
Choose one of following: offset, year, month, day

Antica Bottega Digitale srl
http://www.abd.it

Kristof Coomans

Wednesday 22 March 2006 3:09:43 am

You will have to check first if the tab view_parameter has been set, if not then use some default value.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Daniele Nocentini

Wednesday 22 March 2006 3:24:07 am

yes all right! but exist a "isset" function? I don't find any more about to test if exist a variable.

Antica Bottega Digitale srl
http://www.abd.it

Kristof Coomans

Wednesday 22 March 2006 3:32:24 am

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

You can use it like this:

{if is_set( $view_parameters.tab )}
...
{/if}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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 19 2025 00:56:42
Script start
Timing: Jan 19 2025 00:56:42
Module start 'layout'
Timing: Jan 19 2025 00:56:42
Module start 'content'
Timing: Jan 19 2025 00:56:43
Module end 'content'
Timing: Jan 19 2025 00:56:43
Script end

Main resources:

Total runtime1.0794 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 590.5625152.6406
Module start 'layout' 0.00520.0026 743.203139.4766
Module start 'content' 0.00781.0705 782.6797555.6094
Module end 'content' 1.07820.0011 1,338.289112.1250
Script end 1.0794  1,350.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2941160.0002
Check MTime0.00130.1175160.0001
Mysql Total
Database connection0.00060.057410.0006
Mysqli_queries1.024994.9507600.0171
Looping result0.00090.0819580.0000
Template Total1.048097.120.5240
Template load0.00190.175220.0009
Template processing1.046196.912820.5230
Template load and register function0.00030.023310.0003
states
state_id_array0.00170.154410.0017
state_identifier_array0.00120.106620.0006
Override
Cache load0.00150.1435210.0001
Sytem overhead
Fetch class attribute can translate value0.00110.104620.0006
Fetch class attribute name0.00180.165660.0003
XML
Image XML parsing0.00300.277520.0015
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00310.2883220.0001
String conversion0.00000.000840.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs