Forums / Setup & design / Why won't this snippet work?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Why won't this snippet work?

Author Message

Valentin Svelland

Tuesday 15 July 2003 3:31:04 am

Is there a conflict due to nesting {let}s or something? Can't get inner {section} to output :

----------------------

{* Teller antall artikler i gjeldende folder *}
{let noOfArticles=fetch('content','list_count', hash('parent_node_id',$node.node_id,'class_filter_array',array(2),'class_filter_type','include'))}

{* Sjekker om det er flere en x antall artikler og lister overskytende *}
{switch name=listesjekk match=$noOfArticles}
{case match>=3}

<img src={"spacer_grey.gif"|ezimage} width="470" height="1" /><br />
<h3>Flere saker</h3>

{let article_list=fetch('content','list', hash(parent_node_id,$node.node_id,
sort_by,$node.sort_array,
offset, $view_parameters.offset,
class_filter_type, 'include',
class_filter_array, array( 2 ) ))
}
{section name=bottomlist loop=$article_list max=50 offset=1}
<p class="readmore"><a href={concat("/content/view/full/", $bottomlist:item.node_id, "/")|ezurl}>{$bottomlist:item.name|wash}</a></p>
{/section}
{/let}


{/case}
{/switch}
{/let}

Jan Borsodi

Tuesday 15 July 2003 3:40:21 am

The problem is most likely this line
{case match>=3}
Template functions does support operator handling for their parameters, secondly all template functions are 100% generic which means that switch/case is not a builtin template operation.

You can solve this by using the section function and some operators.
{section show=$noOfArticles|ge(3)}
...
{/section}

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Valentin Svelland

Tuesday 15 July 2003 4:58:15 am

Thanks Jan, that worked out fine!