本文整理匯總了PHP中Frontend::generateFrontendUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Frontend::generateFrontendUrl方法的具體用法?PHP Frontend::generateFrontendUrl怎麽用?PHP Frontend::generateFrontendUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Frontend
的用法示例。
在下文中一共展示了Frontend::generateFrontendUrl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createItem
public function createItem(CreateItemEvent $event)
{
$item = $event->getItem();
if ($item->getType() == 'article') {
$article = \ArticleModel::findByPk($item->getName());
if ($article) {
$page = \PageModel::findByPk($article->pid);
if ($page) {
$cssID = deserialize($article->cssID, true);
$item->setUri(\Frontend::generateFrontendUrl($page->row()) . '#' . (empty($cssID[0]) ? $article->alias : $cssID[0]));
$item->setLabel($article->title);
$item->setExtras($article->row());
}
}
}
}
示例2: createItem
public function createItem(CreateItemEvent $event)
{
$item = $event->getItem();
if ($item->getType() == 'page') {
$page = \PageModel::findByPk($item->getName());
if ($page) {
if ($page->type == 'redirect') {
$uri = $page->url;
$uri = html_entity_decode($uri, ENT_QUOTES, 'UTF-8');
$uri = $this->replaceInsertTags($uri);
} else {
$uri = \Frontend::generateFrontendUrl($page->row());
}
$item->setUri($uri);
$item->setLabel($page->title);
if ($page->cssClass) {
$class = $item->getAttribute('class', '');
$item->setAttribute('class', trim($class . ' ' . $page->cssClass));
$class = $item->getLinkAttribute('class', '');
$item->setLinkAttribute('class', trim($class . ' ' . $page->cssClass));
$class = $item->getLabelAttribute('class', '');
$item->setLabelAttribute('class', trim($class . ' ' . $page->cssClass));
}
if ($page->xnavigationLightbox) {
$item->setLinkAttribute('data-lightbox', 'page-' . $page->id);
if ($page->xnavigationLightboxWidth) {
$item->setLinkAttribute('data-lightbox-width', $page->xnavigationLightboxWidth);
}
if ($page->xnavigationLightboxHeight) {
$item->setLinkAttribute('data-lightbox-height', $page->xnavigationLightboxHeight);
}
}
$currentPage = $this->getCurrentPage();
$item->setExtras($page->row());
$item->setCurrent($currentPage->id == $page->id);
$item->setTrail(in_array($page->id, $currentPage->trail));
}
}
}
示例3: createItem
public function createItem(CreateItemEvent $event)
{
$item = $event->getItem();
if ($item->getType() == 'content') {
$content = \ContentModel::findByPk($item->getName());
if ($content && ($content->ptable == '' || $content->ptable == 'tl_article')) {
$article = \ArticleModel::findByPk($content->pid);
if ($article) {
$page = \PageModel::findByPk($article->pid);
if ($page) {
$headline = deserialize($content->headline, true);
$cssID = deserialize($content->cssID, true);
if (!empty($headline['value']) && !empty($headline['unit']) && !empty($cssID[0])) {
$item->setUri(\Frontend::generateFrontendUrl($page->row()) . '#' . $cssID[0]);
$item->setLabel($headline['value']);
$item->setExtras($content->row());
}
}
}
}
}
}