Skip to content

Instantly share code, notes, and snippets.

@ryan-ethode
Created February 9, 2018 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan-ethode/c79eed283340d1c77a28633c63dd5e12 to your computer and use it in GitHub Desktop.
Save ryan-ethode/c79eed283340d1c77a28633c63dd5e12 to your computer and use it in GitHub Desktop.
Article Category Joomla Module hack to display list in clickable dropdown field rather than in an unordered list.
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
<?php if ($grouped) : ?>
<?php foreach ($list as $group_name => $group) : ?>
<li>
<div class="form-group">
<label for="article-select"><?php echo $group_name; ?></label>
<select class="form-control" id="article-select">
<?php foreach ($group as $item) : ?>
<option onclick="window.location ='<?php echo $item->link; ?>'"><?php echo $item->title; ?>
<?php if ($item->displayHits) : ?>
<span class="mod-articles-category-hits">
(<?php echo $item->displayHits; ?>)
</span>
<?php endif; ?>
<?php if ($item->displayDate) : ?>
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
<?php endif; ?>
</option>
<?php endforeach; ?>
</select>
</div>
</li>
<?php endforeach; ?>
<?php else : ?>
<div class="form-group">
<label for="article-select">Select an Article</label>
<select class="form-control" id="article-select">
<?php foreach ($list as $item) : ?>
<option onclick="window.location ='<?php echo $item->link; ?>'"><?php echo $item->title; ?>
<?php if ($item->displayHits) : ?>
<span class="mod-articles-category-hits">
(<?php echo $item->displayHits; ?>)
</span>
<?php endif; ?>
<?php if ($item->displayDate) : ?>
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
<?php endif; ?>
<?php if ($item->displayCategoryTitle) : ?>
<span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
<?php endif; ?>
</option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment