Forums / Setup & design / Filter and sort mixed content class

Filter and sort mixed content class

Author Message

Olivier Pierret

Tuesday 08 February 2005 4:55:13 am

Hello

I am managing to set up the "news" section of a site. Basically, this section should gather all object whose attribute "is_new" has been set to true, sorted by last publish date.

The problem is that the function fetch( 'content', 'list',... doesn't support filtering on different content classes. So I don't know how to initially retrieve this "news" object list.

Of course I could make a specific call to fetch( 'content', 'list',... for each content class. In this case I would be back in my template with several tables (one by class type actually). I could merge these tables together and then display the list but how can sort these content objects together by publish date? I did not see any sort operator that would do the job easily...

Does someone have any idea on how to solve these problems?

Thank you in advance

Olivier Pierret

PS: If I am not clear enough I can elaborate a bit ;)

Arran Price

Tuesday 08 February 2005 10:31:44 am

Hi Olivier,
You mention using 'list' rather than 'tree' in your fetch so does that mean you are only looking for content in one folder?

I wouldnt class my self as very experienced with ezpublish but heres a few ideas off the top of my head.

Fetch all results and only display the ones that have the is_new set.
eg

{section show=$item.whatever.is_new|eq(true)}
   <p>some code to display whatever I want</p>
{/section}

Without testing - I dont know what the actual syntax for $item....is_new is..

Do what you were intending with the fetch per class but change the way you display it, ie group the items in the way you display them so you dont have to worry about merging your arrays etc (although if you do merge the arrays successfully I would love to see the code you use).
your output could be something like:
New Articles:
article1
article2

New Files:
file1
file2

etc

Hope thats of some help

Arran

Olivier Pierret

Wednesday 09 February 2005 8:19:26 am

"Hope thats of some help" :)

That is exactly the answer I needed. Already in place and working... Thank you so much.

Well... actually I feel a bit stupid now...

Olivier

eZ debug

Timing: Jan 19 2025 01:06:33
Script start
Timing: Jan 19 2025 01:06:33
Module start 'content'
Timing: Jan 19 2025 01:06:33
Module end 'content'
Timing: Jan 19 2025 01:06:33
Script end

Main resources:

Total runtime0.2033 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.0091 589.0547180.8281
Module start 'content' 0.00910.0093 769.882893.8984
Module end 'content' 0.01830.1849 863.7813522.8281
Script end 0.2033  1,386.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00401.9806200.0002
Check MTime0.00160.7670200.0001
Mysql Total
Database connection0.00170.836410.0017
Mysqli_queries0.144470.98751410.0010
Looping result0.00150.75081390.0000
Template Total0.184490.710.1844
Template load0.00120.592110.0012
Template processing0.183290.101010.1832
Override
Cache load0.00070.364910.0007
Sytem overhead
Fetch class attribute can translate value0.00120.602910.0012
XML
Image XML parsing0.00030.134210.0003
General
dbfile0.00753.6881200.0004
String conversion0.00000.002930.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.0001 secs