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

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

eZ debug

Timing: Jan 18 2025 19:39:27
Script start
Timing: Jan 18 2025 19:39:27
Module start 'layout'
Timing: Jan 18 2025 19:39:27
Module start 'content'
Timing: Jan 18 2025 19:39:27
Module end 'content'
Timing: Jan 18 2025 19:39:27
Script end

Main resources:

Total runtime0.0158 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 587.7891152.6094
Module start 'layout' 0.00580.0034 740.398439.4297
Module start 'content' 0.00920.0049 779.828193.2891
Module end 'content' 0.01410.0017 873.117234.3047
Script end 0.0158  907.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002616.3276140.0002
Check MTime0.00127.5715140.0001
Mysql Total
Database connection0.00084.911510.0008
Mysqli_queries0.003018.951430.0010
Looping result0.00000.177810.0000
Template Total0.00138.410.0013
Template load0.00064.096210.0006
Template processing0.00074.316210.0007
Override
Cache load0.00052.871010.0005
General
dbfile0.00021.427280.0000
String conversion0.00000.073840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs