Pin page to top of page tree
Started by Nico Knoll, May 03 2012 04:21 PM
5 replies to this topic
#1
Posted 03 May 2012 - 04:21 PM
Hi,
is there a way to pin a page to the top of the page tree? I mean that every other page is sorted by date but this one.
/ Nico
is there a way to pin a page to the top of the page tree? I mean that every other page is sorted by date but this one.
/ Nico
#2
Posted 03 May 2012 - 06:23 PM
You can do it on the template with $array->shift()
edit: Or, if you want the complete array:
echo $array->shift()->title;
foreach($array->find("sort=date") as $item) echo $item->title;
edit: Or, if you want the complete array:
$first = $array->shift();
$final = $array->find("sort=date")->prepend($first);
#3
Posted 04 May 2012 - 01:56 PM
You could also create and add a checkbox field to your template(s) and call it something like "sticky". When a page has the box checked, it will stick to the top of the list. Then when you perform the call to load your pages, sort by -sticky first, then by -date, i.e.
$pages->find("parent=/news/, sort=-sticky, sort=-date");
#4
Posted 05 May 2012 - 11:39 AM
Well, thank you for the code but I meant in the backend page tree. (I would need a module I guess)
#5
Posted 09 May 2012 - 12:39 PM
So.... I guess I have to write a module for this?
#6
Posted 09 May 2012 - 12:52 PM
I think so. Parent pages don't currently support multiple built-in sort fields for children (like in the API), so it would have to be one sort field or the other. That makes it difficult to pin a page in the admin, even if you can do it easily in your own site. Down the road a bit I think we'll have to add multiple sort fields, which would solve this pretty easily.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













