|
<?php |
|
/** |
|
* Customized tag/default.php file to use blog view for tag listings |
|
*/ |
|
defined('_JEXEC') or die('Restricted access'); |
|
|
|
JLoader::import('joomla.application.component.model'); |
|
|
|
// INSERT HERE THE MENU USED TO LOAD VIEW PARAMS |
|
$menuitemid = 115; |
|
|
|
// Get com_content params |
|
$contentParams = JComponentHelper::getParams( 'com_content' ); |
|
$appParams = JFactory::getApplication()->getParams(); |
|
$appParams->merge( $contentParams); |
|
|
|
JHtml::addIncludePath(JPATH_SITE . '/components/com_content/helpers'); |
|
|
|
JLoader::import( 'articles', JPATH_SITE . '/components/com_content/models' ); |
|
|
|
// Load content language |
|
$lang = JFactory::getLanguage(); |
|
$lang->load('com_content', JPATH_SITE, null, true); |
|
|
|
// Initialize item type arrays |
|
$this->lead_items = array(); |
|
$this->intro_items = array(); |
|
$this->link_items = array(); |
|
|
|
if (count($this->results) > 0) |
|
{ |
|
$ids = array(); |
|
foreach ($this->results as $item) |
|
{ |
|
$ids[] = reset(explode(':', $item->slug)); |
|
} |
|
|
|
// Get full items from articles model |
|
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); |
|
|
|
if ($menuitemid) |
|
{ |
|
$menu = JSite::getMenu(); |
|
$menuparams = $menu->getParams( $menuitemid ); |
|
$appParams->merge( $menuparams ); |
|
} |
|
|
|
$model->setState('params', $appParams); |
|
$model->setState('filter.article_id', $ids); |
|
|
|
$items = $model->getItems(); |
|
|
|
// Params to generate article arrays |
|
$numLeading = $appParams->get('num_leading_articles', 1); |
|
$numIntro = $appParams->get('num_intro_articles', 1); |
|
$numLinks = $appParams->get('num_links', 1); |
|
|
|
// Params for view |
|
$this->columns = $appParams->get('num_columns', 1); |
|
$this->pagination = $model->getPagination(); |
|
|
|
foreach ($items as $pos => $item) |
|
{ |
|
// Generate slug |
|
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; |
|
|
|
// Create empty events properties |
|
$item->event = new stdClass; |
|
$item->event->afterDisplayTitle = null; |
|
$item->event->beforeDisplayContent = null; |
|
$item->event->afterDisplayContent = null; |
|
$item->event->beforeDisplayContent = null; |
|
|
|
if ($numLeading) |
|
{ |
|
$this->lead_items[] = $item; |
|
$numLeading--; |
|
} |
|
elseif ($numIntro) |
|
{ |
|
$this->intro_items[] = $item; |
|
$numIntro--; |
|
} |
|
elseif ($numLinks) |
|
{ |
|
$this->link_items[] = $item; |
|
$numLinks--; |
|
} |
|
} |
|
} |
|
|
|
// Create required category properties |
|
$this->category->id = null; |
|
$this->category->title = $this->searchword; |
|
$this->category->description = ''; |
|
|
|
// Use generated params |
|
$this->params = $appParams; |
|
|
|
// Force content category blog view |
|
$tplOverride = JPATH_SITE . '/templates/'. JFactory::getApplication()->getTemplate() . '/html/com_content/category/'; |
|
$tplDefault = JPATH_SITE . '/components/com_content/views/category/tmpl/'; |
|
|
|
$this->_layout = 'blog'; |
|
$this->_path['template'] = array($tplOverride, $tplDefault); |
|
|
|
$tplFile = file_exists($tplOverride . $this->_layout . '.php') ? $tplOverride . $this->_layout . '.php' : $tplDefault . $this->_layout . '.php'; |
|
require_once $tplFile; |