Example #1
0
 /** 
  * Returns an array of collections as a breadcrumb to the current page
  * @param Page $c
  * @return array $cArray
  */
 public function getTrailToCollection($c)
 {
     $db = Loader::db();
     $cArray = array();
     $currentcParentID = $c->getCollectionParentID();
     if ($currentcParentID > 0) {
         while (is_numeric($currentcParentID) && $currentcParentID > 0 && $currentcParentID) {
             $q = "select cID, cParentID from Pages where cID = '{$currentcParentID}'";
             $r = $db->query($q);
             $row = $r->fetchRow();
             if ($row['cID']) {
                 $cArray[] = Page::getByID($row['cID'], 'ACTIVE');
             }
             $currentcParentID = $row['cParentID'];
             // moving up the tree until we hit 1
         }
     }
     return $cArray;
 }
Example #2
0
 /**
  * Observes the updates of walk pages, to clear its cache
  */
 public function on_page_update(Page $self)
 {
     // Clear out the parent cache entry
     $parent = Page::getByID($self->getCollectionParentID());
     Cache::delete('page_' . $parent->getCollectionTypeHandle(), $parent->getCollectionId());
     // Clear out the parent full-page cache
     $pageCache = PageCache::getLibrary();
     $pageCache->purge($parent);
 }