asleep at the Switch

Author Message

James Ward

Monday 05 May 2003 2:32:05 pm

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,"/")|ezurl}>Page 1</a> |
{section name=Page loop=$page_list}
<a href={concat("/content/view/full/",$Page:item.node_id,"/")|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,"/")|ezurl}>Page 1</a> |
{section name=Page loop=$page_list}
<a href={concat("/content/view/full/",$Page:item.node_id,"/")|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.

working at www.wardnet.com
blogging at www.jamesward.ca

Zinistry Vacana

Monday 05 May 2003 2:52:37 pm

.

James Ward

Monday 05 May 2003 7:54:17 pm

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

working at www.wardnet.com
blogging at www.jamesward.ca

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.