本文整理汇总了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'];
}
示例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'];
}
示例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);
}
示例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;
}