當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Page::getSiteTreeObject方法代碼示例

本文整理匯總了PHP中Concrete\Core\Page\Page::getSiteTreeObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Page::getSiteTreeObject方法的具體用法?PHP Page::getSiteTreeObject怎麽用?PHP Page::getSiteTreeObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Concrete\Core\Page\Page的用法示例。


在下文中一共展示了Page::getSiteTreeObject方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getBySectionOfSite

 /**
  * @param Page $page
  *
  * @return Section
  */
 public static function getBySectionOfSite($page)
 {
     $identifier = sprintf('/multilingual/section/%s', $page->getCollectionID());
     $cache = \Core::make('cache/request');
     $item = $cache->getItem($identifier);
     if (!$item->isMiss()) {
         $returnID = $item->get();
     } else {
         $item->lock();
         $tree = $page->getSiteTreeObject();
         $returnID = false;
         if ($tree instanceof SiteTree) {
             $returnID = $tree->getSiteHomePageID();
         }
         $cache->save($item->set($returnID));
     }
     if ($returnID) {
         return static::getByID($returnID);
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:25,代碼來源:Section.php

示例2: addStackToCategory

 private static function addStackToCategory(\Concrete\Core\Page\Page $parent, $name, $type = 0)
 {
     $data = array();
     $data['name'] = $name;
     if (!$name) {
         $data['name'] = t('No Name');
     }
     $pagetype = PageType::getByHandle(STACKS_PAGE_TYPE);
     $page = $parent->add($pagetype, $data);
     // we have to do this because we need the area to exist before we try and add something to it.
     Area::getOrCreate($page, STACKS_AREA_NAME);
     // finally we add the row to the stacks table
     $db = Database::connection();
     $stackCID = $page->getCollectionID();
     $siteTreeID = $parent->getSiteTreeObject()->getSiteTreeID();
     $v = array($name, $stackCID, $type, $siteTreeID);
     $db->Execute('insert into Stacks (stName, cID, stType, siteTreeID) values (?, ?, ?, ?)', $v);
     $stack = static::getByID($stackCID);
     return $stack;
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:20,代碼來源:Stack.php


注:本文中的Concrete\Core\Page\Page::getSiteTreeObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。