Exclude current parent page from pagelist

Permalink 1 user found helpful
I have a bunch of 3rd level pages (products), each with the 2nd level pages (categories) in a page list block. I want to remove the current parent (category) page on each product page. So I have this:

Home
-Blue
- -Sky
- -Sea
-Yellow
- -Sun
- -Banana
-Orange
etc...

If I am looking at 3rd level product page e.g. 'Sky', I only want the categories 'Yellow' and 'Orange' to show in my page list, and not Blue.

I've looked at this post about not showing the current page as a starting point, but can't work out the correct syntax:
http://www.concrete5.org/community/forums/customizing_c5/exclude-cu...

Thanks.

drbiskit
 
planist1 replied on at Permalink Best Answer Reply
planist1
Not sure if you got this sorted or not, but if you modify the view.php line 11 to this,
<?php  foreach ($pages as $page):
            if ($page->getCollectionID() == Page::getCurrentPage()->getCollectionParentID()) { continue; }  //skip parent of current page
      // Prepare data for each page being listed...


the page list should not include the parent page of the page being viewed.
drbiskit replied on at Permalink Reply 1 Attachment
drbiskit
Great, that works a treat.

I had actually ended up doing it with Auto nav which worked fine, but this is much more straightforward, and better for my particular application.

Nice one - cheers!

In case anyone else needs it, I've attached the custom template file here.