Parent page title by section, how to?

Permalink
Hello all, I need to get the parent ID of a certain section, eg;

services
-service A
-- service A-B
-- service A-C
-- service A-D

I need to get the ID of service A regardless of the level, what I need is a way to check if service A has childs and grandchild's and if so service A-B, service A-C and service A-D will always display the title of service A.

I'm using this code found on another post here but in order to make it do what I need I have to change the $rcobj object manually for a level to use;

<?php 
      global $c;
      $nh = Loader::helper('navigation');
      $cobj = $nh->getTrailToCollection($c);
      ?>
            <?php
         $rcobj = array_reverse($cobj);
         if(is_object($rcobj[1]))
         {
            $pID  = $rcobj[1]->getCollectionID();
            $page = Page::getByID($pID);  
            $title= $page->getCollectionName();
         }else{
            $title= $c->getCollectionName();
         }


Or..is there a way to search backwards on the page object array from the getTrailToCollection function for a certain attribute and if found get the ID of the page where the attribute was found?

Any help? confusing?

mdzoidberg
 
mdzoidberg replied on at Permalink Reply
mdzoidberg
Anyone? please... :)