Source for file category.php
Documentation is available at category.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Base HTML View class for the a Category list
* The category model object for this category
* The list of other categories for this extension.
* The name of the extension for the category
* The name of the view to link individual items to
* Default title to use for page title
* Method with common display elements used in category list displays
$params =
$app->getParams();
// Get some data from the models
$state =
$this->get('State');
$items =
$this->get('Items');
$category =
$this->get('Category');
$children =
$this->get('Children');
$parent =
$this->get('Parent');
$pagination =
$this->get('Pagination');
if (count($errors =
$this->get('Errors')))
// Check whether category access level allows access.
$groups =
$user->getAuthorisedViewLevels();
if (!in_array($category->access, $groups))
// Setup the category parameters.
$cparams =
$category->getParams();
$category->params =
clone($params);
$category->params->merge($cparams);
$children =
array($category->id =>
$children);
// Escape strings for HTML output
$maxLevel =
$params->get('maxLevel', -
1);
$this->maxLevel =
&$maxLevel;
$this->params =
&$params;
$this->parent =
&$parent;
// Check for layout override only if this is not the active menu item
// If it is the active menu item, then the view and category id will match
$active =
$app->getMenu()->getActive();
if ((!$active) ||
((strpos($active->link, 'view=category') ===
false) ||
(strpos($active->link, '&id=' . (string)
$this->category->id) ===
false)))
if ($layout =
$category->params->get('category_layout'))
elseif (isset
($active->query['layout']))
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
* Execute and display a template script.
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
* @return mixed A string if successful, otherwise a Error object.
public function display($tpl =
null)
* Method to prepares the document
$menus =
$app->getMenu();
$this->pathway =
$app->getPathway();
// Because the application sets a default page title, we need to get it from the menu item itself
$this->menu =
$menus->getActive();
$this->params->def('page_heading', $this->params->get('page_title', $this->menu->title));
$title =
$this->params->get('page_title', '');
$title =
$app->get('sitename');
elseif ($app->get('sitename_pagetitles', 0) ==
1)
$title =
JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
elseif ($app->get('sitename_pagetitles', 0) ==
2)
$title =
JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
$this->document->setDescription($this->params->get('menu-meta_description'));
if ($this->params->get('menu-meta_keywords'))
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
if ($this->params->get('robots'))
$this->document->setMetadata('robots', $this->params->get('robots'));
* Method to add an alternative feed link to a category layout.
if ($this->params->get('show_feed_link', 1) ==
1)
$link =
'&format=feed&limitstart=';
$attribs =
array('type' =>
'application/rss+xml', 'title' =>
'RSS 2.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=rss'), 'alternate', 'rel', $attribs);
$attribs =
array('type' =>
'application/atom+xml', 'title' =>
'Atom 1.0');
$this->document->addHeadLink(JRoute::_($link .
'&type=atom'), 'alternate', 'rel', $attribs);
Documentation generated on Tue, 19 Nov 2013 14:55:21 +0100 by phpDocumentor 1.4.3