当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::addStatic方法代码示例

本文整理汇总了PHP中Concrete\Core\Page\Page::addStatic方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::addStatic方法的具体用法?PHP Page::addStatic怎么用?PHP Page::addStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Concrete\Core\Page\Page的用法示例。


在下文中一共展示了Page::addStatic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createPageInTree

 public static function createPageInTree($cPath, TreeInterface $tree, $moveToRoot = false, $pkg = null)
 {
     $txt = Loader::helper('text');
     // trim off a leading / if there is one
     $cPath = trim($cPath, '/');
     // now we grab the parent collection, if there is a static one.
     $pages = explode('/', $cPath);
     $parent = $tree->getSiteTreeObject()->getSiteHomePageObject();
     // now we iterate through the pages  to ensure that they exist in the system before adding the new guy
     $pathPrefix = '';
     $checkGlobally = false;
     for ($i = 0; $i < count($pages); ++$i) {
         $currentPath = $pathPrefix . $pages[$i];
         if ($i == 0) {
             // First, we check the first path to see if it falls outside of the root already. If it does,
             // we're not going to check within the site for them
             $rootPage = CorePage::getByPath("/" . $currentPath);
             if (!$rootPage->isError() && $rootPage->getSiteTreeID() == 0) {
                 // That means we've already added this as a system page, like Dashboard, etc... Which means
                 // that we add the subsequent pages globally
                 $checkGlobally = true;
             }
         }
         $pathToFile = static::getPathToNode($currentPath, $pkg);
         // check to see if a page at this point in the tree exists
         if (!$checkGlobally) {
             $c = CorePage::getByPath("/" . $currentPath, 'RECENT', $tree);
         } else {
             $c = CorePage::getByPath("/" . $currentPath);
         }
         if ($c->isError() && $c->getError() == COLLECTION_NOT_FOUND) {
             // create the page at that point in the tree
             $data = array();
             $data['handle'] = $pages[$i];
             $data['name'] = $txt->unhandle($data['handle']);
             $data['filename'] = $pathToFile;
             $data['uID'] = USER_SUPER_ID;
             if ($pkg != null) {
                 $data['pkgID'] = $pkg->getPackageID();
             }
             if ($moveToRoot) {
                 $newC = Page::addStatic($data, $tree);
                 $newC->moveToRoot();
                 // change cparent ID back to 0
             } else {
                 $newC = Page::addStatic($data, $parent);
             }
             $parent = $newC;
         } else {
             $parent = $c;
         }
         $pathPrefix = $currentPath . '/';
     }
     return $parent;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:55,代码来源:Single.php

示例2: addStatic

 public function addStatic($data)
 {
     return parent::addStatic($data);
 }
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:4,代码来源:__IDE_SYMBOLS__.php


注:本文中的Concrete\Core\Page\Page::addStatic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。