Forums / Developer / I can't sort by date

I can't sort by date

Author Message

Adolfo Barragán

Tuesday 07 October 2003 1:12:12 am

I'm trying fetch a list of classes and I need this list is sort by date (an attribute).

I put this code:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array(array('attribute',false(),179))
))}

179 is the attribute Id for my ezdate field, but my list is unordered.

What's is wrong?

Regards
Adolfo Barragan

David Syers

Monday 13 October 2003 10:20:10 am

Hi Adolfo

Try:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array('attribute',array(179,false()))
))}

or:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array('class_identifier',array('your_ezdate_field_identifier',false()))
))}

Adolfo Barragán

Monday 13 October 2003 11:58:56 pm

I try both pieces of code, but none send me results.

Tony Wood

Friday 31 October 2003 8:55:26 am

I get this as well, I am on 3.2-3. Other sorted work fine, its just sort by a date doesn't work for me.

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Alexandre Cunha

Wednesday 05 November 2003 10:33:08 am

How can i reverse order by date or other field ?

http://AlexandreCunha.com

Joris Lint

Thursday 06 November 2003 6:59:25 am

For reverse order, you can take a look at:
http://ezwiki.blanko.info/index.php/3XHT_FetchFunction

Tore Skobba

Thursday 18 December 2003 7:03:49 am

Hmm did anyone manage to solve this by the use of sorting at fetch? I did not and I am seeking for an solution. Currently I am using the "date" (datefield) as the name pattern and then sorting all objects on the name pattern.

UPDATE: I managed it now (sometimes I am bit to fast on the post button). Heres how I did it:

{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}

Where 175 is the id for the attribute which content is to be sorted on.

cheers
Tore

Adolfo Barragán

Friday 19 December 2003 12:22:49 am

> Currently I am using the "date" (datefield) as the
> name pattern and then sorting all objects on the
> name pattern.

But this is not a solution. My date field is not required, so I can use it for name.

Regards
Adolfo

Mike Borozdin

Sunday 21 December 2003 6:40:07 am

Hmm, eZ Publish keeps the date of posting an article somehow, but I don't know how. Do you know?

I think, if we knew how we could use its date field instead of creating our own field.

eZ debug

Timing: Jan 18 2025 16:19:01
Script start
Timing: Jan 18 2025 16:19:01
Module start 'content'
Timing: Jan 18 2025 16:19:02
Module end 'content'
Timing: Jan 18 2025 16:19:02
Script end

Main resources:

Total runtime0.9527 sec
Peak memory usage4,096.0000 KB
Database Queries222

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.6094180.8438
Module start 'content' 0.00630.8086 768.4531781.2422
Module end 'content' 0.81490.1377 1,549.6953340.4609
Script end 0.9526  1,890.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4112210.0002
Check MTime0.00150.1569210.0001
Mysql Total
Database connection0.00070.077210.0007
Mysqli_queries0.867391.02852220.0039
Looping result0.00230.23732200.0000
Template Total0.914496.020.4572
Template load0.00210.222120.0011
Template processing0.912395.751320.4561
Template load and register function0.00010.011810.0001
states
state_id_array0.00620.650210.0062
state_identifier_array0.00140.142620.0007
Override
Cache load0.00180.1936620.0000
Sytem overhead
Fetch class attribute can translate value0.00120.126180.0002
Fetch class attribute name0.00080.0873100.0001
XML
Image XML parsing0.00150.162480.0002
class_abstraction
Instantiating content class attribute0.00000.0017100.0000
General
dbfile0.00330.3450270.0001
String conversion0.00000.000630.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 37
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs