In Joomla 2.5.8, I've created a menu item that uses the "List All Categories" type. I'm wanting to display the image AND Title for the parent category and the images for each subcategory as follows:
-- Parent Category Image --
Parent Category Title Parent Category Description
SubCategory1 Title Subcategory1 Image -- SubCategory1 Description
SubCategory2 Title Subcategory2 Image -- SubCategory2 Description
SubCategory3 Title Subcategory3 Image -- SubCategory3 Description
SubCategory4 Title Subcategory4 Image -- SubCategory4 Description
I'm working in the file template/html/com_content/categories/default.php and I've tried copying the code from the blog.php file:
<?php if ($this->params->get('show_description_image') && $this->category->getParams()->get('image')) : ?>
<img src="<?php echo $this->category->getParams()->get('image'); ?>"/>
<?php endif; ?>
But it breaks the page and loads a blank page. The titles of the subcategories and their descriptions show, I'm just missing the parent title and the images.
In the options for the menu item I have the category title, description and image all set to show.
Any help on this would be greatly appreciated.
here's the deafault.php code:
<?php
/**
* @package Joomla.Site
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
?>
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_base_description')) : ?>
<?php //If there is a description in the menu parameters use that; ?>
<?php if($this->params->get('categories_description')) : ?>
<?php echo JHtml::_('content.prepare', $this->params->get('categories_description'), '', 'com_content.categories'); ?>
<?php else: ?>
<?php //Otherwise get one from the database if it exists. ?>
<?php if ($this->parent->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare', $this->parent->description, '', 'com_content.categories'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php
echo $this->loadTemplate('items');
?>