eZ Community » Forums » Setup & design » asleep at the Switch
expandshrink

asleep at the Switch

asleep at the Switch

Monday 05 May 2003 11:32:05 pm - 2 replies

I am having trouble with a switch statement. I am attempting to clean up my Multiple Page Article How-To by only having it display the page numbers if there is more than one page.

Currently this shows page numbers regardless of whether there are more than one:

{* Subpages *}
<table width="100%">
<td valign="top">
<h2>Pages</h2>
<a href={concat("/content/view/full/",$node.node_id,"/"blunk.gif Emoticon|ezurl}>Page 1</a> |
{section name=Page loop=$page_list}
<a href={concat("/content/view/full/",$Page:item.node_id,"/"blunk.gif Emoticon|ezurl}>{$Page:item.name|wash}</a> |
{/section}
</td>
</table>

I thought I could make this a little more intelligent by adding a switch which whould check the number of elements in the $page_list array and decide if it needed to display page numbers. Here is what I have:

{switch match=count($page_list)}
{case match=0)}
{/case}
{case}
{* Subpages *}
<table width="100%">
<td valign="top">
<h2>Pages</h2>
<a href={concat("/content/view/full/",$node.node_id,"/"blunk.gif Emoticon|ezurl}>Page 1</a> |
{section name=Page loop=$page_list}
<a href={concat("/content/view/full/",$Page:item.node_id,"/"blunk.gif Emoticon|ezurl}>{$Page:item.name|wash}</a> |
{/section}
</td>
</table>
{/case}
{/switch}

Is there a not-equal operator available for case? I do not like have to use
{case match=0}
{/case}
Just to get to the point where I know it is not-equal to zero. I tried != and <> to no avail.

I apologize if this is in the documentation somewhere and I just haven't found it but I really did look. It just seems to me that there must be a better why.

Thanks in advance.

Modified on Tuesday 06 May 2003 4:17:31 am by James Ward

Monday 05 May 2003 11:52:37 pm

.

Modified on Tuesday 06 May 2003 1:11:39 pm by Zinistry Vacana

Tuesday 06 May 2003 4:54:17 am

Man do I feel dumb.
Right there in the documentation looking at me.

{case match=not(0)}
{/case}

Anyone else looking for a full list of logical operators can find them at
http://www.ez.no/sdk/ref/view/class/eZTemplateLogicOperator#_details

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from