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


PHP PageModel::getFrontendUrl方法代碼示例

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


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

示例1: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     $link = '/articles/';
     $objArticle = $this->objArticle;
     if ($objArticle->inColumn != 'main') {
         $link .= $objArticle->inColumn . ':';
     }
     $link .= $objArticle->alias ?: $objArticle->id;
     $this->Template->href = $this->objParent->getFrontendUrl($link);
     // Clean the RTE output
     $this->Template->text = \StringUtil::toHtml5($objArticle->teaser);
     $this->Template->headline = $objArticle->title;
     $this->Template->readMore = \StringUtil::specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->title));
     $this->Template->more = $GLOBALS['TL_LANG']['MSC']['more'];
 }
開發者ID:contao,項目名稱:core-bundle,代碼行數:18,代碼來源:ContentTeaser.php

示例2: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     $link = '/articles/';
     $objArticle = $this->objArticle;
     if ($objArticle->inColumn != 'main') {
         $link .= $objArticle->inColumn . ':';
     }
     $link .= $objArticle->alias != '' && !\Config::get('disableAlias') ? $objArticle->alias : $objArticle->id;
     $this->Template->href = $this->objParent->getFrontendUrl($link);
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->Template->text = \StringUtil::toXhtml($objArticle->teaser);
     } else {
         $this->Template->text = \StringUtil::toHtml5($objArticle->teaser);
     }
     $this->Template->headline = $objArticle->title;
     $this->Template->readMore = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->title));
     $this->Template->more = $GLOBALS['TL_LANG']['MSC']['more'];
 }
開發者ID:bytehead,項目名稱:contao-core,代碼行數:24,代碼來源:ContentTeaser.php

示例3: getUrl

 /**
  * Get the category URL
  *
  * @param \PageModel $page
  *
  * @return string
  */
 public function getUrl(\PageModel $page)
 {
     $page->loadDetails();
     return $page->getFrontendUrl('/' . NewsCategories::getParameterName($page->rootId) . '/' . $this->alias);
 }
開發者ID:hielsnoppe,項目名稱:contao-test-plugin,代碼行數:12,代碼來源:NewsCategoryModel.php

示例4: findSearchablePages

 /**
  * Get all searchable pages and return them as array
  *
  * @param integer $pid
  * @param string  $domain
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public static function findSearchablePages($pid = 0, $domain = '', $blnIsSitemap = false)
 {
     $time = \Date::floorToMinute();
     $objDatabase = \Database::getInstance();
     // Get published pages
     $objPages = $objDatabase->prepare("SELECT * FROM tl_page WHERE pid=? AND (start='' OR start<='{$time}') AND (stop='' OR stop>'" . ($time + 60) . "') AND published='1' ORDER BY sorting")->execute($pid);
     if ($objPages->numRows < 1) {
         return array();
     }
     // Fallback domain
     if ($domain == '') {
         $domain = \Environment::get('base');
     }
     $arrPages = array();
     $objRegistry = \Model\Registry::getInstance();
     // Recursively walk through all subpages
     while ($objPages->next()) {
         $objPage = $objRegistry->fetch('tl_page', $objPages->id);
         if ($objPage === null) {
             $objPage = new \PageModel($objPages);
         }
         if ($objPage->type == 'regular') {
             // Searchable and not protected
             if ((!$objPage->noSearch || $blnIsSitemap) && (!$objPage->protected || \Config::get('indexProtected') && (!$blnIsSitemap || $objPage->sitemap == 'map_always')) && (!$blnIsSitemap || $objPage->sitemap != 'map_never')) {
                 // Published
                 if ($objPage->published && ($objPage->start == '' || $objPage->start <= $time) && ($objPage->stop == '' || $objPage->stop > $time + 60)) {
                     $feUrl = $objPage->getFrontendUrl();
                     if (strncmp($feUrl, 'http://', 7) !== 0 && strncmp($feUrl, 'https://', 8) !== 0) {
                         $feUrl = $domain . $feUrl;
                     }
                     $arrPages[] = $feUrl;
                     // Get articles with teaser
                     $objArticles = $objDatabase->prepare("SELECT * FROM tl_article WHERE pid=? AND (start='' OR start<='{$time}') AND (stop='' OR stop>'" . ($time + 60) . "') AND published='1' AND showTeaser='1' ORDER BY sorting")->execute($objPages->id);
                     if ($objArticles->numRows) {
                         $feUrl = $objPage->getFrontendUrl('/articles/%s');
                         if (strncmp($feUrl, 'http://', 7) !== 0 && strncmp($feUrl, 'https://', 8) !== 0) {
                             $feUrl = $domain . $feUrl;
                         }
                         while ($objArticles->next()) {
                             $arrPages[] = sprintf($feUrl, $objArticles->alias != '' && !\Config::get('disableAlias') ? $objArticles->alias : $objArticles->id);
                         }
                     }
                 }
             }
         }
         // Get subpages
         if ((!$objPage->protected || \Config::get('indexProtected')) && ($arrSubpages = static::findSearchablePages($objPage->id, $domain, $blnIsSitemap)) != false) {
             $arrPages = array_merge($arrPages, $arrSubpages);
         }
     }
     return $arrPages;
 }
開發者ID:bytehead,項目名稱:contao-core,代碼行數:61,代碼來源:Backend.php


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