本文整理汇总了PHP中ContentHelperRoute::getSectionRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentHelperRoute::getSectionRoute方法的具体用法?PHP ContentHelperRoute::getSectionRoute怎么用?PHP ContentHelperRoute::getSectionRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentHelperRoute
的用法示例。
在下文中一共展示了ContentHelperRoute::getSectionRoute方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
global $mainframe;
$doc =& JFactory::getDocument();
$params =& $mainframe->getParams();
// Get some data from the model
JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));
// Lets get our data from the model
$rows =& $this->get('Data');
$section =& $this->get('Section');
$doc->link = JRoute::_(ContentHelperRoute::getSectionRoute($section->id));
foreach ($rows as $row) {
// strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// url link to article
// & used instead of & as this is converted by feed creator
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
// strip html from feed item description text
$description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = $link;
$item->description = $description;
$item->date = $row->created;
$item->category = $row->category;
// loads item info into rss array
$doc->addItem($item);
}
}
示例2: plgSearchSections
/**
* Sections Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchSections($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchSectionAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'sections');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.title AS title, a.description AS text, a.name, ' . ' "" AS created,' . ' "2" AS browsernav,' . ' a.id AS secid' . ' FROM #__sections AS a' . ' WHERE ( a.name LIKE ' . $text . ' OR a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ' )' . ' AND a.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
$rows[$i]->section = JText::_('Section');
}
$return = array();
foreach ($rows as $key => $section) {
if (searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
$return[] = $section;
}
}
return $return;
}
示例3: plgSearchJFSections
/**
* Sections Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchJFSections($text, $phrase = '', $ordering = '', $areas = null)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$registry = JFactory::getConfig();
$lang = $registry->getValue("config.jflang");
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchSectionAreas()))) {
return array();
}
}
// load plugin params info
$plugin = JPluginHelper::getPlugin('search', 'jfsections');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$activeLang = $pluginParams->def('active_language_only', 0);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.title AS title, a.description AS text,' . ' "" AS created,' . ' "2" AS browsernav,' . ' a.id AS secid,' . ' jfl.code as jflang, jfl.title as jflname' . ' FROM #__sections AS a' . "\n LEFT JOIN #__jf_content as jfc ON reference_id = a.id" . "\n LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.lang_id" . ' WHERE jfc.value LIKE ' . $text . ' AND a.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . "\n AND jfc.reference_table = 'sections'" . ($activeLang ? "\n AND jfl.code = '{$lang}'" : '') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
$rows[$i]->section = JText::_('Section') . " - " . $rows[$i]->jflname;
}
return $rows;
}
示例4: getItems
function getItems($args)
{
global $mainframe;
$advlink =& AdvLink::getInstance();
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
$sections = AdvlinkContent::_section();
$items = array();
$view = isset($args->view) ? $args->view : '';
switch ($view) {
default:
foreach ($sections as $section) {
$items[] = array('id' => ContentHelperRoute::getSectionRoute($section->id), 'name' => $section->title, 'class' => 'folder content');
}
// Check Static/Uncategorized permissions
if ($advlink->checkAccess('advlink_static', '1')) {
$items[] = array('id' => 'option=com_content&view=uncategorized', 'name' => JText::_('UNCATEGORIZED'), 'class' => 'folder content nolink');
}
break;
case 'section':
$categories = AdvLink::getCategory($args->id);
foreach ($categories as $category) {
$items[] = array('id' => ContentHelperRoute::getCategoryRoute($category->slug, $args->id), 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
}
break;
case 'category':
$articles = AdvlinkContent::_articles($args->id);
foreach ($articles as $article) {
$items[] = array('id' => ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid), 'name' => $article->title . ' / ' . $article->alias, 'class' => 'file');
}
break;
case 'uncategorized':
$statics = AdvlinkContent::_statics();
foreach ($statics as $static) {
$items[] = array('id' => ContentHelperRoute::getArticleRoute($static->id), 'name' => $static->title . ' / ' . $static->alias, 'class' => 'file');
}
break;
}
return $items;
}
示例5:
?>
<p class="meta">
<?php
if ($this->item->params->get('show_author') && $this->item->author != "") {
JText::printf('Written by', $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author);
}
if ($this->item->params->get('show_create_date')) {
echo ' ' . JText::_('on') . ' ' . JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'));
}
echo '. ';
if ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) {
echo JText::_('Posted in ');
if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->section->title)) {
if ($this->item->params->get('link_section')) {
echo '<a href="' . JRoute::_(ContentHelperRoute::getSectionRoute($this->item->sectionid)) . '">';
}
echo $this->section->title;
if ($this->item->params->get('link_section')) {
echo '</a>';
}
if ($this->item->params->get('show_category')) {
echo ' - ';
}
}
if ($this->item->params->get('show_category') && $this->item->catid) {
if ($this->item->params->get('link_category')) {
echo '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug, $this->item->sectionid)) . '">';
}
echo $this->item->category;
if ($this->item->params->get('link_category')) {
示例6: getLinks
public function getLinks($args) {
$wf = WFEditorPlugin::getInstance();
require_once(JPATH_SITE . '/components/com_content/helpers/route.php');
$items = array();
$view = isset($args->view) ? $args->view : '';
switch ($view) {
// get top-level sections / categories
default:
$sections = self::_getSection();
foreach ($sections as $section) {
$url = '';
// Joomla! 1.5
if (method_exists('ContentHelperRoute', 'getSectionRoute')) {
$id = ContentHelperRoute::getSectionRoute($section->id);
$view = 'section';
} else {
$id = ContentHelperRoute::getCategoryRoute($section->slug);
$view = 'category';
}
if (strpos($id, 'index.php?Itemid=') !== false) {
$url = self::_getMenuLink($id);
$id = 'index.php?option=com_content&view=' . $view . '&id=' . $section->id;
}
$items[] = array(
'url' => $url,
'id' => $id,
'name' => $section->title,
'class' => 'folder content'
);
}
// Check Static/Uncategorized permissions
if (!defined('JPATH_PLATFORM') && $wf->checkAccess('static', 1)) {
$items[] = array(
'id' => 'option=com_content&view=uncategorized',
'name' => WFText::_('WF_LINKS_JOOMLALINKS_UNCATEGORIZED'),
'class' => 'folder content nolink'
);
}
break;
// get categories in section or sub-categories (Joomla! 1.6+)
case 'section':
$articles = array();
// Joomla! 1.5
if (method_exists('ContentHelperRoute', 'getSectionRoute')) {
$categories = WFLinkBrowser::getCategory($args->id, 'com_content');
} else {
$categories = WFLinkBrowser::getCategory('com_content', $args->id);
// get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
$articles = self::_getArticles($args->id);
}
foreach ($categories as $category) {
$url = '';
$id = ContentHelperRoute::getCategoryRoute($category->id, $args->id);
if (strpos($id, 'index.php?Itemid=') !== false) {
$url = self::_getMenuLink($id);
$id = 'index.php?option=com_content&view=category&id=' . $category->id;
}
$items[] = array(
'url' => $url,
'id' => $id,
'name' => $category->title . ' / ' . $category->alias,
'class' => 'folder content'
);
}
if (!empty($articles)) {
// output article links
foreach ($articles as $article) {
// Joomla! 1.5
if (isset($article->sectionid)) {
$id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid);
} else {
$id = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug);
}
$items[] = array(
'id' => $id,
'name' => $article->title . ' / ' . $article->alias,
'class' => 'file'
);
$anchors = self::getAnchors($article->content);
foreach ($anchors as $anchor) {
$items[] = array(
'id' => $id . '#' . $anchor,
'name' => '#' . $anchor,
'class' => 'file anchor'
//.........这里部分代码省略.........
示例7: defined
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<ul class="sections<?php
echo $params->get('moduleclass_sfx');
?>
"><?php
foreach ($list as $item) {
?>
<li>
<a href="<?php
echo JRoute::_(ContentHelperRoute::getSectionRoute($item->id));
?>
">
<?php
echo $item->title;
?>
</a>
</li>
<?php
}
?>
</ul>
示例8: if
<?php echo $this->article->event->beforeDisplayContent; ?>
<?php if (isset ($this->article->toc)) : ?>
<?php echo $this->article->toc; ?>
<?php endif; ?>
<?php echo $this->article->text; ?>
<?php echo $this->article->event->afterDisplayContent; ?>
<?php /** Begin Article Sec/Cat **/ if (($this->params->get('show_section') && $this->article->sectionid) || ($this->params->get('show_category') && $this->article->catid)) : ?>
<p class="rt-article-cat">
<?php if ($this->params->get('show_section') && $this->article->sectionid && isset($this->article->section)) : ?>
<span class="rt-section">
<?php if ($this->params->get('link_section')) : ?>
<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid)).'">'; ?>
<?php endif; ?>
<?php echo $this->escape($this->article->section); ?>
<?php if ($this->params->get('link_section')) : ?>
<?php echo '</a>'; ?>
<?php endif; ?>
<?php if ($this->params->get('show_category')) : ?>
<?php echo ' - '; ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($this->params->get('show_category') && $this->article->catid) : ?>
<span class="rt-category">
<?php if ($this->params->get('link_category')) : ?>
<?php echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->article->catslug, $this->article->sectionid)).'">'; ?>
<?php endif; ?>
示例9: _getUrl15
private function _getUrl15($node)
{
$url = '';
switch ($node->type) {
case 'article':
$url = str_replace('&', '&', ContentHelperRoute::getArticleRoute($node->id, $node->catid, $node->section));
break;
case 'category':
$url = str_replace('&', '&', ContentHelperRoute::getCategoryRoute($node->catid, $node->section));
break;
default:
$url = str_replace('&', '&', ContentHelperRoute::getSectionRoute($node->sectionid));
}
return $url;
}
示例10: getSectionURL
/**
* Takes in a section id and returns the relative
* blog URL for that section.
*
* @param integer $sectionid
* @return string URL
*/
function getSectionURL($sectionid)
{
return JRoute::_(ContentHelperRoute::getSectionRoute($sectionid) . '&layout=blog');
}
示例11:
}
?>
<?php
if ($this->params->get('show_section') && $this->article->sectionid || $this->params->get('show_category') && $this->article->catid) {
?>
<?php
if ($this->params->get('show_section') && $this->article->sectionid && isset($this->article->section)) {
?>
<span class="article-section">
<?php
if ($this->params->get('link_section')) {
?>
<a href="<?php
echo JRoute::_(ContentHelperRoute::getSectionRoute($this->article->sectionid));
?>
">
<?php
}
?>
<?php
echo $this->article->section;
?>
<?php
if ($this->params->get('link_section')) {
?>
</a>
<?php
}
示例12:
?>
<div class="article-toolswrap">
<div class="article-tools clearfix">
<div class="article-meta">
<?php
if ($this->item->params->get('show_section') && $this->item->sectionid || $this->item->params->get('show_category') && $this->item->catid) {
?>
<?php
if ($this->item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) {
?>
<span class="article-section">
<?php
if ($this->item->params->get('link_section')) {
?>
<a href="<?php
echo JRoute::_(ContentHelperRoute::getSectionRoute($this->item->sectionid));
?>
">
<?php
}
?>
<?php
echo $this->item->section;
?>
<?php
if ($this->item->params->get('link_section')) {
?>
</a><?php
}
?>
<?php
示例13:
echo $this->escape($item->title);
?>
</a></h4>
<?php
if ($this->params->get('show_section') && $item->sectionid && isset($item->section) || $this->params->get('show_category') && $item->catid) {
?>
<div>
<?php
if ($this->params->get('show_section') && $item->sectionid && isset($item->section)) {
?>
<span>
<?php
if ($this->params->get('link_section')) {
?>
<?php
echo '<a href="' . JRoute::_(ContentHelperRoute::getSectionRoute($item->sectionid)) . '">' . $item->section . '</a>';
?>
<?php
} else {
?>
<?php
echo $item->section;
?>
<?php
}
?>
<?php
if ($this->params->get('show_category') && $item->catid) {
?>
- <?php
}
示例14: getDatas
function getDatas(&$helper, $params)
{
$catsid = $params->get('catsid');
$type = $helper->get('type');
if (!is_array($catsid)) {
$arr_cats[] = $catsid;
} else {
$arr_cats = $catsid;
}
$moduleid = $helper->moduleid;
foreach ($arr_cats as $cat) {
$type_arr = explode('.', $cat);
$type = $type_arr[0];
$catid = isset($type_arr[1]) ? $type_arr[1] : 0;
$params_cat = new JParameter('');
$cooki_name = 'mod' . $moduleid . '_' . $type . $catid;
if (isset($_COOKIE[$cooki_name]) && $_COOKIE[$cooki_name] != '') {
$cookie_user_setting = $_COOKIE[$cooki_name];
$arr_values = explode('&', $cookie_user_setting);
if ($arr_values) {
foreach ($arr_values as $row) {
list($k, $value) = explode('=', $row);
if ($k != '') {
$params_cat->set($k, $value);
}
}
}
}
//$catid = $helper->get('chooseCatid');
$_categories = array();
$_section = array();
$articles = array();
$cats = array();
if (!$catid) {
continue;
}
if ($type == 'sec') {
$_section = $this->loadSection($catid, $helper);
$_categories = $this->loadCategories($catid, 'section', $helper);
$cat_link = JRoute::_(ContentHelperRoute::getSectionRoute($_section->id));
$cat_title = $_section->title;
$cat_desc = $_section->description;
} elseif ($type == 'cat') {
$cats = $this->loadCategories($catid, 'category', $helper);
if ($cats) {
foreach ($cats as $cat) {
$cat_link = JRoute::_(ContentHelperRoute::getCategoryRoute($cat->id, $cat->section));
$cat_title = $cat->title;
$cat_desc = $cat->description;
$_section = $cat;
break;
}
}
}
if (!count($_section) && !count($_categories)) {
return;
}
$_categories_org = $_categories;
$cookie_catsid = array();
if ($params_cat->get('cookie_catsid', '') != '') {
$cookie_catsid = explode(',', $params_cat->get('cookie_catsid', ''));
if ($_categories) {
$temp = array();
foreach ($_categories as $k => $cat) {
if (in_array($cat->id, $cookie_catsid)) {
$temp[] = $_categories[$k];
}
}
$_categories = $temp;
}
}
if ($helper->get('groupbysubcat', 0)) {
$maxSubCats = $params_cat->get('maxSubCats', $helper->get('maxSubCats', -1));
if ($maxSubCats == -1) {
$maxSubCats = count($_categories);
}
$temp = array();
if ($_categories) {
$i = 0;
foreach ($_categories as $j => $cat) {
$rows = $this->getArticles($cat->id, $helper, $params_cat);
if ($rows) {
$temp[] = $cat;
$articles[$cat->id] = $rows;
$i++;
if ($i == $maxSubCats) {
break;
}
}
}
$_categories = $temp;
}
} else {
$catids = array();
if ($_categories) {
foreach ($_categories as $cat) {
$catids[] = $cat->id;
}
} elseif ($cats) {
$catids[] = $_section->id;
//.........这里部分代码省略.........