function getCategoryRoute($catid, $sectionid) { $needles = array('category' => (int) $catid, 'section' => (int) $sectionid); //Create the link $link = 'index.php?option=com_content&view=category&id=' . $catid; if ($item = ContentHelperRoute::_findItem($needles)) { if (isset($item->query['layout'])) { $link .= '&layout=' . $item->query['layout']; } $link .= '&Itemid=' . $item->id; } return $link; }
public static function getCategoryRoute($catid) { jimport('joomla.application.categories'); $categoryTree = JCategories::getInstance('com_content'); $category = $categoryTree->get($catid); $catids = array(); $catids[] = $category->id; while ($category->getParent() instanceof JCategoryNode) { $category = $category->getParent(); $catids[] = $category->id; } $catids = array_reverse($catids); $needles = array('category' => $catids); $category = $categoryTree->get($catid); //Create the link $link = 'index.php?option=com_content&view=category&id=' . $category->slug; if ($item = ContentHelperRoute::_findItem($needles)) { if (isset($item->query['layout'])) { $link .= '&layout=' . $item->query['layout']; } $link .= '&Itemid=' . $item->id; } return $link; }
/** * Deprecated, use ContentHelper::getItemid instead. * * @since 1.0 * @deprecated As of version 1.5 * @see ContentHelperRoute::getArticleRoute() */ function getItemid($id) { require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'; // Load the article data to know what section/category it is in. $article =& JTable::getInstance('content'); $article->load($id); $needles = array('article' => (int) $id, 'category' => (int) $article->catid, 'section' => (int) $article->sectionid); $item = ContentHelperRoute::_findItem($needles); $return = is_object($item) ? $item->id : null; return $return; }
public static function _findItemExt($needles = null) { return parent::_findItem($needles); }