Saturday 04 December 2010 6:15:19 am
Why don't you make one single fetch using a double sort array so you can sort them by your attribute "article/highlight" and then by publish date with a limit of 10. So that you'll first have the highlighted nodes listed by publish date and then the others..
Hi Jean-Luc, thanks for your reply. Surely a neater way ..
{def $items=fetch('content', 'tree', hash('parent_node_id', 2, 'sort_by', array( array( 'attribute', false(), 'article/highlight' ), array( 'attribute', false(), 'article/publish_date')), 'class_filter_type', 'include', 'class_filter_array', array('article'), 'limit', 10))}
... But what I need to do is arranging those fetched items according to their publish date and push the highlithed ones in the list keeping just one order In other words, instead of getting this result.. e.g. 2.12.2010 - 30.11.2010 - 28.11.2010 (the highlighted ones) - 1.12.2010 - 29.11.2010 - 25.11.2010 - ... (the others) I should get.. 2.12.2010 (highlighted) - 1.12.2010 - 30.11.2010 (highlighted) - 29.11.2010 - 28.11.2010 (highlighted) - 25.11.2010 - ... Well, someone may say "then why don't you just sort by date without using any attribute_filter?!" The thing is that if the 10th item is dated, let's say, 30.7.2010, and there's a need to highlight one dated 1.7.2010, this one should be forced to be the last of the list of 10 items and get the place of 30.7.2010...
loredanaebook.it
|