/**
  * Gets the parent pages recursivly to the page whose parentid is passed or the current object
  *
  * @param int $parentid The parentid of the page to get the parents of
  * @param bool $initparents
  * @return array
  */
 function getParents(&$parentid = '', $initparents = true)
 {
     global $parentpages, $_zp_zenpage;
     $allitems = $_zp_zenpage->getPages();
     if ($initparents) {
         $parentpages = array();
     }
     if (empty($parentid)) {
         $currentparentid = $this->getParentID();
     } else {
         $currentparentid = $parentid;
     }
     foreach ($allitems as $item) {
         $obj = new ZenpagePage($item['titlelink']);
         $itemtitlelink = $obj->getTitlelink();
         $itemid = $obj->getID();
         $itemparentid = $obj->getParentID();
         if ($itemid == $currentparentid) {
             array_unshift($parentpages, $itemtitlelink);
             $obj->getParents($itemparentid, false);
         }
     }
     return $parentpages;
 }