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

eZ debug

Timing: Jan 19 2025 01:11:11
Script start
Timing: Jan 19 2025 01:11:11
Module start 'content'
Timing: Jan 19 2025 01:11:11
Module end 'content'
Timing: Jan 19 2025 01:11:12
Script end

Main resources:

Total runtime0.2811 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.8438180.8516
Module start 'content' 0.00530.0055 769.695397.8203
Module end 'content' 0.01080.2702 867.5156526.9766
Script end 0.2810  1,394.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00351.2534200.0002
Check MTime0.00140.4981200.0001
Mysql Total
Database connection0.00050.165110.0005
Mysqli_queries0.232382.66271410.0016
Looping result0.00150.52061390.0000
Template Total0.269996.010.2699
Template load0.00090.308910.0009
Template processing0.269095.708810.2690
Override
Cache load0.00060.215610.0006
Sytem overhead
Fetch class attribute can translate value0.00200.718710.0020
XML
Image XML parsing0.00030.096410.0003
General
dbfile0.00250.8993200.0001
String conversion0.00000.002030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

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

Time used to render debug report: 0.0002 secs