Forums / Setup & design / Filtering News

Filtering News

Author Message

PaoloMellerio kk

Monday 03 November 2003 3:53:31 am

Hi,
I've a section of my website which contains some news: this news have a field date, which refers to the date event shown in the news itself. This news may be published in advice, that is to say, that today i can publish a news which refers to a future time, i.e. 25 december 2003. Is there a way to filter these news according to the actual date (currentdate) in a way that i can show the past news and the future news in two different list of my site?
The news must be all in the same folder, it doesn't care if they refers to past or future, I simply would compare the field date of the news (input by user) with the currentdate (today) and generate two separate lists, one with the "past" news, and the other with "future" news.
I've tried with the follwing fetch:

{let children=fetch(content,list,hash(parent_node_id,46, attribute_filter, array(178, '<=', 'currentdate()')))}

where 46 is the ID of the folder containg my news and 178 is the ID of the field date of my news class, but it doesn't work... any idea?

Thanks in advice.

Paolo Mellerio (Clikka!com)

Paolo Mellerio
http://www.clikka.com

Marco Zinn

Monday 03 November 2003 1:48:08 pm

Hi,
have a look here:
http://www.ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/operators/data_fetch

Then, why did you put 'currentdate()' in quotes? Did you try without?

Then, I read a thread here somewhere (cannot find it now), that the attributefilter likes to see an "OR" operator, even if you have just one condition
[from the documents page: .... attribute_filter,
array( 'or', array( 152, '=', 'abc' ), array( 153, '=', '42' ) ) ]

Try to construct something like this:
{let children=fetch(content,list,hash(parent_node_id,46, attribute_filter, array ( 'or', array(178, '<=', currentdate()), ) ))}
or
{let children=fetch(content,list,hash(parent_node_id,46, attribute_filter, array ( 'or', array(178, '<=', currentdate()), false() ) ))}

Marco
http://www.hyperroad-design.com

PaoloMellerio kk

Monday 03 November 2003 11:55:09 pm

Hi Marco,

Thanks for your suggestion but I've tried both solutions but no news is shown... are you sure about the fact the "I read a thread here somewhere (cannot find it now), that the attributefilter likes to see an "OR" operator, even if you have just one condition"?
It seems to be a strange thing: the docs shows an example with a filter based on two conditions, isn't it?
Any other idea?

Paolo

Paolo Mellerio
http://www.clikka.com