本文整理汇总了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());
}
}
}
}
}
}