combination attribute_filter for fetch with both AND and OR

combination attribute_filter for fetch with both AND and OR

Monday 22 March 2010 10:56:09 am - 2 replies

Author Message

Kelly Milligan

Monday 22 March 2010 11:20:52 am

just to add to the above, I have this working

{def $articles = fetch( 'content', 'list',
hash( 'parent_node_id', 174,
'sort_by', array( 'attribute', false(), 'article/publish_date' ),
'attribute_filter', array('and',
array('article/publish_date', '<=', $timestamp),
array('article/unpublish_date', '>=', $timestamp),
array('article/firstname', '=', $firstname),
array('article/lastname', '=', $lastname )),
'class_filter_type', 'include',
'class_filter_array', array( 'article' ),
'depth', '5' ) )}

but want to enable null publish and unpublish dates.

Kelly Milligan

Monday 22 March 2010 11:38:13 am

ended up with this, but I am hoping that there is a way to build this into the fetch statement

{foreach $articles as $article}

{if and(or(le($article.data_map.publish_date.content.timestamp, $timestamp), eq($article.data_map.publish_date.content.timestamp, '')),or(ge($article.data_map.unpublish_date.content.timestamp, $timestamp), eq($article.data_map.unpublish_date.content.timestamp, '')))}

<li><a href={$article.url|ezurl()} title="{$article.data_map.title.content|wash()}">{$article.data_map.title.content|wash()}</a></li> {/if}

{/foreach}

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

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