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


PHP PageRepository::getPageIdFromAlias方法代码示例

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


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

示例1: getUrlStr

 /**
  * generates a string for the URL
  *
  * @param	array	$uParts	the parts of the URL
  * @return	string	the URL string
  */
 function getUrlStr($uParts)
 {
     $baseURL = $this->getBaseURL();
     if (is_array($uParts) && GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') == $uParts['host']) {
         $m = array();
         // do we have an id?
         if (preg_match('/(?:^|&)id=([0-9a-z_]+)/', $uParts['query'], $m)) {
             $isInt = MathUtility::canBeInterpretedAsInteger($m[1]);
             if ($isInt) {
                 $uid = intval($m[1]);
             } else {
                 $uid = $this->sys_page->getPageIdFromAlias($m[1]);
             }
             $temp_root_line = $this->sys_page->getRootLine($uid);
             $temp_page = array_shift($temp_root_line);
             // array_shift reverses the array (rootline has numeric index in the wrong order!)
             $temp_root_line = array_reverse($temp_root_line);
             $query = preg_replace('/(?:^|&)id=([0-9a-z_]+)/', '', $uParts['query']);
             $urlstr = GeneralUtility::fixed_lgd_cs($temp_page['title'], 50) . GeneralUtility::fixed_lgd_cs($query ? ' / ' . $query : '', 20);
         } else {
             $urlstr = $baseURL . substr($uParts['path'], 1);
             $urlstr .= $uParts['query'] ? '?' . $uParts['query'] : '';
             $urlstr .= $uParts['fragment'] ? '#' . $uParts['fragment'] : '';
         }
     } else {
         $urlstr = ($uParts['host'] ? $uParts['scheme'] . '://' . $uParts['host'] : $baseURL) . $uParts['path'];
         $urlstr .= $uParts['query'] ? '?' . $uParts['query'] : '';
         $urlstr .= $uParts['fragment'] ? '#' . $uParts['fragment'] : '';
     }
     return $urlstr;
 }
开发者ID:preinboth,项目名称:direct_mail,代码行数:37,代码来源:Statistics.php

示例2: fixPageId

 /**
  * Fixes page id if it is not a direct numeric page id.
  */
 protected function fixPageId()
 {
     if (!MathUtility::canBeInterpretedAsInteger($this->urlParameters['id'])) {
         // Seems to be an alias
         $alias = $this->urlParameters['id'];
         $this->urlParameters['id'] = $this->pageRepository->getPageIdFromAlias($alias);
         if ($this->urlParameters['id'] === 0) {
             throw new \Exception(sprintf('Page with alias "%s" does not exist.', $alias), 1457183797);
         }
     }
 }
开发者ID:olek07,项目名称:GiGaBonus,代码行数:14,代码来源:UrlEncoder.php

示例3: checkAndSetAlias

 /**
  * Fetches the integer page id for a page alias.
  * Looks if ->id is not an integer and if so it will search for a page alias and if found the page uid of that page is stored in $this->id
  *
  * @return void
  * @access private
  * @todo Define visibility
  */
 public function checkAndSetAlias()
 {
     if ($this->id && !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->id)) {
         $aid = $this->sys_page->getPageIdFromAlias($this->id);
         if ($aid) {
             $this->id = $aid;
         } else {
             $this->pageNotFound = 4;
         }
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:19,代码来源:TypoScriptFrontendController.php


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