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


PHP PageManager::fetchChildPages方法代码示例

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


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

示例1: editPageChildren

 /**
  * This function will update all children of a particular page (if any)
  * by renaming/moving all related files to their new path and updating
  * their database information. This is a recursive function and will work
  * to any depth.
  *
  * @param integer $page_id
  *  The ID of the Page whose children need to be updated
  * @param string $page_path
  *  The path of the Page, which is the handles of the Page parents. If the
  *  page has multiple parents, they will be separated by a forward slash.
  *  eg. article/read. If a page has no parents, this parameter should be null.
  * @return boolean
  */
 public static function editPageChildren($page_id = null, $page_path = null)
 {
     if (!is_int($page_id)) {
         return false;
     }
     $page_path = trim($page_path, '/');
     $children = PageManager::fetchChildPages($page_id);
     foreach ($children as $child) {
         $child_id = $child['id'];
         $fields = array('path' => $page_path);
         if (!PageManager::createPageFiles($page_path, $child['handle'], $child['path'], $child['handle'])) {
             $success = false;
         }
         if (!PageManager::edit($child_id, $fields)) {
             $success = false;
         }
         self::editPageChildren($child_id, $page_path . '/' . $child['handle']);
     }
     return $success;
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:34,代码来源:class.pagemanager.php


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