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


PHP Director::currentPage方法代码示例

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


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

示例1: recordPageID

 private function recordPageID()
 {
     $currentPage = Director::currentPage();
     if ($currentPage) {
         $this->PageID = $currentPage->ID;
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:7,代码来源:PageView.php

示例2: getBlogHolder

	function getBlogHolder() {
		$page = Director::currentPage();
		
		if($page->is_a("BlogHolder")) {
			return $page;
		} else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) {
			return $page->getParent();
		} else {
			return DataObject::get_one("BlogHolder");
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:11,代码来源:BlogManagementWidget.php

示例3: getBlogHolder

	function getBlogHolder() {
		$page = Director::currentPage();
		
		if($page instanceof BlogHolder) {
			return $page;
		} elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) {
			return $page->getParent();
		} else {
			return DataObject::get_one('BlogHolder');
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:11,代码来源:ArchiveWidget.php

示例4: addPage

 static function addPage()
 {
     $historyString = Session::get("LastPagesVisited");
     $historyArray = unserialize($historyString);
     if (!is_array($historyArray)) {
         $historyArray = array();
     }
     $page = Director::currentPage();
     if ($page) {
         $pageID = $page->ID;
         if ($pageID) {
             if (!in_array($pageID, $historyArray)) {
                 array_unshift($historyArray, $pageID);
                 if (count($historyArray) > self::$number_of_pages_back) {
                     array_pop($historyArray);
                 }
             } elseif ($historyArray[count($historyArray) - 1] == $pageID) {
                 array_pop($historyArray);
                 array_unshift($historyArray, $pageID);
             }
         }
     }
     Session::set("LastPagesVisited", serialize($historyArray));
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-widgets-latestpagesvisited,代码行数:24,代码来源:LatestPagesVisitedWidget.php

示例5: prepareCurrentAndSection

 /**
  * This function is used for isCurrent() and isSection() to prepare
  * the cached answers.
  */
 protected function prepareCurrentAndSection()
 {
     if (!self::$currentPageID) {
         self::$currentPageID = Director::currentPage() ? Director::currentPage()->ID : null;
         if (!isset(self::$currentPageID)) {
             self::$currentPageID = -1;
             $nextID = Director::currentPage() && isset(Director::currentPage()->Parent->ID) ? Director::currentPage()->Parent->ID : null;
         } else {
             $nextID = SiteTree::$currentPageID;
         }
         $table = Versioned::current_stage() == "Live" ? "SiteTree_Live" : "SiteTree";
         SiteTree::$currentSectionIDs = array();
         while ($nextID) {
             self::$currentSectionIDs[] = $nextID;
             $nextID = DB::query("SELECT ParentID FROM SiteTree WHERE ID = {$nextID}")->value();
         }
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:22,代码来源:SiteTree.php

示例6: prepareCurrentAndSection

	/**
	 * This function is used for isCurrent() and isSection() to prepare
	 * the cached answers.
	 */
	protected function prepareCurrentAndSection() {
		if(!self::$currentPageID || Director::urlParam('URLSegment') != self::$currentPageIDSetFromURLSegment) {
			self::$currentPageID = Director::currentPage() ? Director::currentPage()->ID : null;
			self::$currentPageIDSetFromURLSegment = Director::urlParam('URLSegment');
			
			if(!isset(self::$currentPageID)) {
				self::$currentPageID = -1;
				$nextID = (Director::currentPage() && isset(Director::currentPage()->Parent->ID))
					? Director::currentPage()->Parent->ID
					: null;
			} else {
				$nextID = SiteTree::$currentPageID;
			}

			$table = (Versioned::current_stage() == "Live")
				? "SiteTree_Live"
				: "SiteTree";

			SiteTree::$currentSectionIDs = array();
			while($nextID) {
				self::$currentSectionIDs[] = $nextID;
				$nextID = DB::query("SELECT ParentID FROM SiteTree WHERE ID = $nextID")->value();
			}
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:29,代码来源:SiteTree.php


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