Numinous Productions Website and Graphic Design

The Article Categories module provides a useful way to allow visitors to browse large chunks of content at a glance. This hack allows you to provide a slightly more elegant way of presenting your information. Rather than showing a simple list of categories, this hack turns this module into a dropdown field. Each category in the dropdown, once clicked, takes users immediately to their category of choice.

Fairfield Dropdown Categories Module

This hack requires making a small change to one of the core Joomla files... if you aren't comfortable doing this, I would avoid this solution.


How to Display Joomla Categories in a Dropdown Field (Joomla 3.4.x):

You will need to edit this file: .../modules/mod_articles_categories/tmpl/default_items.php

My tweaked code looks like this:

How to Display Joomla Categories in a Dropdown Field (Joomla 2.5.x):

You will need to edit this file: .../modules/mod_articles_categories/tmpl/default_items.php

My tweaked code looks like this:

/** * @package Joomla.Site 
* @subpackage   mod_articles_categories 
* @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. 
* @license      GNU General Public License version 2 or later; see LICENSE.txt 
*/// no direct accessdefined('_JEXEC') or die;foreach ($list as $item) :?>  

<option onclick="window.location = '<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>'" <?php if ($_SERVER['PHP_SELF'] == JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"';?>> <?php $levelup=$item->level-$startLevel -1; ?> 

<h<?php echo $params->get('item_heading')+ $levelup; ?>>     
<?php echo $item->title;?>
</h<?php echo $params->get('item_heading')+ $levelup; ?>>     

if($params->get('show_description', 0))
      {echo JHtml::_('content.prepare', $item->description, $item->getParams(),'mod_articles_categories.content');     
if($params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0) || ($params->get('maxlevel') >= ($item->level - $startLevel))) && count($item->getChildren()))      {        
echo '<ul>';        
$temp = $list;        
$list = $item->getChildren();
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default').'_items');        
$list = $temp;        
echo '</ul>';

<?php endforeach; ?>

Basically, the list elements are replaced with field elements. There was also the need to change how the link is created to conform to a list style "on-click" route instead of the normal "<a href".

Along with making this tweak to the code, I changed the "Maximum Level Depth" to 1 in the Module Parameters. Make sure to do a proper template override on this module, or else you'll lose your changes on the next Joomla upgrade.

Hopefully this helps someone tackle this issue without investing tons of time reading up on it.




Numinous Productioncircle icon 356 37th Street SW, Barberton, OH 44203circle icon740-438-8851circle