Top Left Text cha

Website Development Services

  • Duplicate default.php in the category list template located at modules/mod_articles_category.  In Joomla 3.4.5, it is located one folder deeper at /modules/mod_articles_category/tmpl/.
  • Rename it whatever you would like.  I renamed mine inpagelinks.php.
  • Replace the contents with the code below and upload the new file to the same folder.
  • Go to your module in th module manager and change the template to the new one that you just created.

 

<?php
/**
 * @package Joomla.Site
 * @subpackage mod_articles_category
 * @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 access
defined('_JEXEC') or die;
?>
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
    <?php if ($grouped) : ?>
        <?php foreach ($list as $group_name => $group) : ?>
            <li>
                <h<?php echo $item_heading; ?>><?php echo $group_name; ?></h<?php echo $item_heading; ?>>
                <ul>
                    <?php foreach ($group as $item) : ?>
                        <li>
                            <h<?php echo $item_heading+1; ?>>
                                <?php if ($params->get('link_titles') == 1) : ?>
                                    <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?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; ?></a>
                                <?php else :?>
                                    <?php echo $item->title; ?>
                                    <?php if ($item->displayHits) :?>
                                        <span class="mod-articles-category-hits">
           (<?php echo $item->displayHits; ?>)  </span>
                                    <?php endif; ?></a>
                                <?php endif; ?>
                            </h<?php echo $item_heading+1; ?>>
 
 
                            <?php if ($params->get('show_author')) :?>
                                <span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
                            <?php endif;?>
 
                            <?php if ($item->displayCategoryTitle) :?>
                                <span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
                            <?php endif; ?>
                            <?php if ($item->displayDate) : ?>
                                <span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
                            <?php endif; ?>
                            <?php if ($params->get('show_introtext')) :?>
                                <p class="mod-articles-category-introtext">
                                    <?php echo $item->displayIntrotext; ?>
                                </p>
                            <?php endif; ?>
 
                            <?php if ($params->get('show_readmore')) :?>
                                <p class="mod-articles-category-readmore">
                                    <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
                                        <?php if ($item->params->get('access-view')== FALSE) :
                                            echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
                                        elseif ($readmore = $item->alternative_readmore) :
                                            echo $readmore;
                                            echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                                            if ($params->get('show_readmore_title', 0) != 0) :
                                                echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
                                            endif;
                                        elseif ($params->get('show_readmore_title', 0) == 0) :
                                            echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
                                        else :
 
                                            echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
                                            echo JHtml::_('string.truncate', ($item->title), $params->get('readmore_limit'));
                                        endif; ?>
                                    </a>
                                </p>
                            <?php endif; ?>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
        <?php endforeach; ?>
</ul>
 
<?php else : ?>
<p>
<form name="jump" class="center">
<select name="menu">
        <?php foreach ($list as $item) : ?>
 
                <h<?php echo $item_heading; ?>>
                    <?php if ($params->get('link_titles') == 1) : ?>
                    <option value="#<?php echo $item->title; ?>">
                            <?php echo $item->title; ?>
                            </option>
                    <?php else :?>
                        <?php echo $item->title; ?>
                        <?php if ($item->displayHits) :?>
                            <span class="mod-articles-category-hits">
            (<?php echo $item->displayHits; ?>)  </span>
                        <?php endif; ?></a>
                    <?php endif; ?>
                </h<?php echo $item_heading; ?>>
 
                <?php if ($params->get('show_author')) :?>
                    <span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
                <?php endif;?>
                <?php if ($item->displayCategoryTitle) :?>
                    <span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
                <?php endif; ?>
                <?php if ($item->displayDate) : ?>
                    <span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
                <?php endif; ?>
                <?php if ($params->get('show_introtext')) :?>
                    <p class="mod-articles-category-introtext">
                        <?php echo $item->displayIntrotext; ?>
                    </p>
                <?php endif; ?>
 
                <?php if ($params->get('show_readmore')) :?>
                    <p class="mod-articles-category-readmore">
                        <a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
                            <?php if ($item->params->get('access-view')== FALSE) :
                                echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
                            elseif ($readmore = $item->alternative_readmore) :
                                echo $readmore;
                                echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                            elseif ($params->get('show_readmore_title', 0) == 0) :
                                echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
                            else :
                                echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
                                echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
                            endif; ?>
                        </a>
                    </p>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </select>
        <input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
    </form>
</p>
    <?php endif; ?>
</ul>
 

Comments   

0 #1 Ramesh 2015-10-31 17:40
Hi,
I tried this in Joomla 3.4.5. Drop down is listed with empty categories. Can you please check it?
Quote
+1 #2 Timothy Johns 2015-10-31 18:16
I just tried it, Ramesh... I updated Joomla to 3.4.5 on my sandbox site, duplicated default.php and called it dropdown.php, selected that in the advanced tab on the categories module, and it seems to be working fine. The only issue I noticed in my directions (which I'm going to correct right now) is the path to default.php has changed slightly in Joomla 3.4.5. It should be in modules/mod_articles_category/tmpl.

Make sure you're adding this file in mod_articles_category and not mod_articles_categories. Then make sure the module you're using is actually the 'articles - category' and not 'articles - categories'. I know it seems very odd... you would think I would have done this in the 'article - categories' module, but I did it in the 'category' module. And it works.
Quote
0 #3 Ramesh 2015-10-31 19:27
Dear Timothy Johns,

Thanks for your immediate reply. As you said, I wrongly understood that it was for 'articles - categories'.

Actually I was looking for a code that would display the categories in dropdown for the module 'articles - categories'.

Can you please give me the code to do so? It would be a great help to me.

Regards,
Ramesh
Quote
0 #4 Timothy Johns 2015-11-02 17:30
There's no point in that, Ramesh. If, with the alternate template, the category module will do what you need, then there's no need to make the categories module do exactly the same thing. I believe I originally used the category module for this instead of the categories module because it had more options that I wanted to take advantage of.

As you can see in my example/test of the module (http://joomla.tjohns.co/ - 'dropdown module' on the right side), you can display as many categories/sub-categories as you want.
Quote

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X