english/components/com_content/views/featured/view.html.php
/**
	 * Display the view
	 *
	 * @return	mixed	False on error, null otherwise.
	 */
Display the view
@return      mixed   False on error, null otherwise.
Display the view @return mixed False on error null otherwise .
function display($tpl = null)
	{
		$user = JFactory::getUser();
		$app = JFactory::getApplication();
		$state 		= $this->get('State');
		$items 		= $this->get('Items');
		$pagination	= $this->get('Pagination');
		if (count($errors = $this->get('Errors'))) {
			JError::raiseWarning(500, implode("\n", $errors));
			return false;
		}
		$params = &$state->params;
		$numLeading = $params->def('num_leading_articles', 1);
		$numIntro = $params->def('num_intro_articles', 4);
		$numLinks = $params->def('num_links', 4);
		foreach ($items as $i => & $item)
		{
			$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
			$item->catslug = ($item->category_alias) ? ($item->catid . ':' . $item->category_alias) : $item->catid;
			$item->parent_slug = ($item->parent_alias) ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
			if ($item->parent_alias == 'root') {
				$item->parent_slug = null;
			}
			$item->event = new stdClass();
			$dispatcher = JDispatcher::getInstance();
			if ($i < $numLeading + $numIntro)
			{
				$item->introtext = JHtml::_('content.prepare', $item->introtext);
				$results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$item->params, 0));
				$item->event->afterDisplayTitle = trim(implode("\n", $results));
				$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, 0));
				$item->event->beforeDisplayContent = trim(implode("\n", $results));
				$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$item->params, 0));
				$item->event->afterDisplayContent = trim(implode("\n", $results));
			}
		}
		$max = count($items);
		$limit = $numLeading;
		for ($i = 0; $i < $limit && $i < $max; $i++)
		{
			$this->lead_items[$i] = &$items[$i];
		}
		$limit = $numLeading + $numIntro;
		for ($i = $numLeading; $i < $limit && $i < $max; $i++)
		{
			$this->intro_items[$i] = &$items[$i];
		}
		$this->columns = max(1, $params->def('num_columns', 1));
		$order = $params->def('multi_column_order', 1);
		if ($order == 0 && $this->columns > 1)
		{
			$this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns);
		}
		for ($i = $numLeading + $numIntro; $i < $max; $i++)
		{
			$this->link_items[$i] = &$items[$i];
		}
		$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
		$this->assignRef('params', $params);
		$this->assignRef('items', $items);
		$this->assignRef('pagination', $pagination);
		$this->assignRef('user', $user);
		$this->_prepareDocument();
		parent::display($tpl);
	}
function display ( $ tpl = null ) { $ user = JFactory :: getUser ( ) ; $ app = JFactory :: getApplication ( ) ; $ state = $ this -> get ( 'State' ) ; $ items = $ this -> get ( 'Items' ) ; $ pagination = $ this -> get ( 'Pagination' ) ; if ( count ( $ errors = $ this -> get ( 'Errors' ) ) ) { JError :: raiseWarning ( 500 , implode ( " \n " , $ errors ) ) ; return false ; } $ params = & $ state -> params ; $ numLeading = $ params -> def ( 'num_leading_articles' , 1 ) ; $ numIntro = $ params -> def ( 'num_intro_articles' , 4 ) ; $ numLinks = $ params -> def ( 'num_links' , 4 ) ; foreach ( $ items as $ i => & $ item ) { $ item -> slug = $ item -> alias ? ( $ item -> id . ':' . $ item -> alias ) : $ item -> id ; $ item -> catslug = ( $ item -> category_alias ) ? ( $ item -> catid . ':' . $ item -> category_alias ) : $ item -> catid ; $ item -> parent_slug = ( $ item -> parent_alias ) ? ( $ item -> parent_id . ':' . $ item -> parent_alias ) : $ item -> parent_id ; if ( $ item -> parent_alias == 'root' ) { $ item -> parent_slug = null ; } $ item -> event = new stdClass ( ) ; $ dispatcher = JDispatcher :: getInstance ( ) ; if ( $ i < $ numLeading + $ numIntro ) { $ item -> introtext = JHtml :: _ ( 'content.prepare' , $ item -> introtext ) ; $ results = $ dispatcher -> trigger ( 'onContentAfterTitle' , array ( 'com_content.article' , & $ item , & $ item -> params , 0 ) ) ; $ item -> event -> afterDisplayTitle = trim ( implode ( " \n " , $ results ) ) ; $ results = $ dispatcher -> trigger ( 'onContentBeforeDisplay' , array ( 'com_content.article' , & $ item , & $ item -> params , 0 ) ) ; $ item -> event -> beforeDisplayContent = trim ( implode ( " \n " , $ results ) ) ; $ results = $ dispatcher -> trigger ( 'onContentAfterDisplay' , array ( 'com_content.article' , & $ item , & $ item -> params , 0 ) ) ; $ item -> event -> afterDisplayContent = trim ( implode ( " \n " , $ results ) ) ; } } $ max = count ( $ items ) ; $ limit = $ numLeading ; for ( $ i = 0 ; $ i < $ limit && $ i < $ max ; $ i ++ ) { $ this -> lead_items [ $ i ] = & $ items [ $ i ] ; } $ limit = $ numLeading + $ numIntro ; for ( $ i = $ numLeading ; $ i < $ limit && $ i < $ max ; $ i ++ ) { $ this -> intro_items [ $ i ] = & $ items [ $ i ] ; } $ this -> columns = max ( 1 , $ params -> def ( 'num_columns' , 1 ) ) ; $ order = $ params -> def ( 'multi_column_order' , 1 ) ; if ( $ order == 0 && $ this -> columns > 1 ) { $ this -> intro_items = ContentHelperQuery :: orderDownColumns ( $ this -> intro_items , $ this -> columns ) ; } for ( $ i = $ numLeading + $ numIntro ; $ i < $ max ; $ i ++ ) { $ this -> link_items [ $ i ] = & $ items [ $ i ] ; } $ this -> pageclass_sfx = htmlspecialchars ( $ params -> get ( 'pageclass_sfx' ) ) ; $ this -> assignRef ( 'params' , $ params ) ; $ this -> assignRef ( 'items' , $ items ) ; $ this -> assignRef ( 'pagination' , $ pagination ) ; $ this -> assignRef ( 'user' , $ user ) ; $ this -> _prepareDocument ( ) ; parent :: display ( $ tpl ) ; }
Display the view
 @return      mixed   False on error, null otherwise.
Display the view @return mixed False on error null otherwise .
// Initialise variables. // Check for errors. // PREPARE THE DATA // Get the metrics for the structural page layout. // Compute the article slugs and prepare introtext (runs content plugins). // No link for ROOT category // Ignore content plugins on links. // Preprocess the breakdown of leading, intro and linked articles. // This makes it much easier for the designer to just interogate the arrays. // The first group is the leading articles. // The second group is the intro articles. // Order articles across, then down (or single column mode) // call order down helper // The remainder are the links. //Escape strings for HTML output