Page list block - how do I create a list of ALL pages in ALL tiered subdirectories

Permalink
Hi,

I'm new to C5 so forgive me for my ignorance... I'm trying to rebuild my sitehttp://www.romanticretreats.co.uk using C5. How do I create a page list block that displays not only the pages from the directories below it but also from any directories lower down?

For example, the pagehttp://www.romanticretreats.co.uk/romantic-cottages.php... on the current site shows ALL cottages, the pagehttp://www.romanticretreats.co.uk/romantic-cottages/north-england.p... shows only those in North England andhttp://www.romanticretreats.co.uk/romantic-cottages/north-england/t... shows only those in The Lake District. The actual cottages each have a page in that particular directory.

Is this also possibly in C5? How would I do this?

Thanks for your help,

Konrad

sparkdigital
 
Steevb replied on at Permalink Reply 1 Attachment
Steevb
Hi,

Each page has to be allowed to shown in the page list, not excluded.

When you add your page list block set options in pop up to allow all and everywhere.

Pick Alphabetical or site map order.

See attached.

Hope that helped
jordanlev replied on at Permalink Reply
jordanlev
Unfortunately the Page List block doesn't let you list all pages at all levels beneath a certain page -- major bummer, I know.

You have a few options here:
* Instead of pulling in all pages beneath a certain page, filter by page type and make sure all the pages below a certain page are of that page type.

* Don't have sub-directories. You can use the free "Force Single Sublevel" addon to enforce this automatically so users don't have to remember.

* Use the autonav block instead, and customize its output to look like your page list. You can try using my new spiffy easier-to-customize autonav template if you want to go this route:
https://github.com/jordanlev/c5_clean_block_templates/blob/master/au...

But I know these are all sub-optimal solutions -- would be nice if this was addressed in the core system some time.
RadiantWeb replied on at Permalink Reply
RadiantWeb
wouldn't be hard at all to code a custom page_list block that will pull all pages under given page. Although, I would restrict that to a particular page_type so that you could exclude parent pages if you wish.

Chad
jordanlev replied on at Permalink Reply
jordanlev
I'm not so sure about that -- since the Page List block uses the PageList model, and the PageList model doesn't seem to provide any kind of filters for "all subpages beneath one page" -- it only seems to filter direct children of a specific page. Hopefully I'm wrong though, as this would solve a lot of problems.
RadiantWeb replied on at Permalink Reply
RadiantWeb
I'm saying...A simple attribute such as "include_in_full_search" or something on each page....then just add a filter for that attribute. you would still want a custom page_list block to do that with though., and then page_types would provide you greater flexibility.

Chad
jordanlev replied on at Permalink Reply
jordanlev
Ahh... I see. That is a clever solution. In fact, if you weren't using the "is_featured" attribute for anything else, you could use that for this and have it work out-of-the-box without needing to create an alternate block.
The only downside is if there are a *lot* of pages in the section you're dealing with then it becomes quite burdensome to remember to check that attribute for every page.
andrew replied on at Permalink Reply
andrew
Do something like this:

$pl = new PageList();
$pl->filterByPath($page->getCollectionPath());
$pages = $pl->get();


Will return all children. filterByPath returns all children by default, which works pretty well, because it's path-based. It could be slightly performance intensive since it's a like DB query, but we haven't noticed a problem searching under large nodes on our site, which is pretty large.

You can see this functionality by searching in the dashboard > sitemap > page search, and choosing "beneath page" and selected "search all users under selected page."

Hope this helps!
jordanlev replied on at Permalink Reply
jordanlev
Oh, snap! Never knew about that one -- thanks Andrew.
Is this something you'd accept as a pull request if I added this option to the built-in page list block? It comes up in the forums quite a bit.
andrew replied on at Permalink Reply
andrew
Yes, absolutely. This would be very handy.