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.