This Joomla 4 override allows you to display a list of articles with the same tag simply using the Joomla's mod_tags_similar module. At the bottom of this article, you can download the files of the override.

Joomla 4 frontend rendering

PhP markup

<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_tags_similar
 * @author  	web-eau.net
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Router\Route;

if (!$list)
{
	return;
}

?>

<div class="mx-auto text-center py-5">
  <h2 class="display-4">
    Similar tags
  </h2>
</div>

<div class="tagssimilar<?php echo $moduleclass_sfx; ?>">
	<?php if ($list) : ?>
	<div class="row">
		<?php foreach ($list as $i => $item) : ?>
		<div class="col my-1">
          <div class="border bg-light p-3 h-100">
			<?php if (($item->type_alias === 'com_users.category') || ($item->type_alias === 'com_banners.category')) : ?>
			<?php if (!empty($item->core_title)) : ?>
			<?php echo htmlspecialchars($item->core_title, ENT_COMPAT, 'UTF-8'); ?>
			<?php endif; ?>
			<?php else : ?>

			<h5><a href="<?php echo JRoute::_($item->link); ?>" class="text-decoration-none">
				<?php if (!empty($item->core_title)) : ?>
				<?php echo htmlspecialchars($item->core_title, ENT_COMPAT, 'UTF-8'); ?>
				<?php endif; ?>
			</a></h5>
          
			<?php endif; ?>
		</div>
      </div>
		<?php endforeach; ?>
	</div>
	<?php else : ?>
    <div class="alert alert-info" role="alert">
		<i class="fa fa-info-circle"></i> <span><?php echo JText::_('MOD_TAGS_SIMILAR_NO_MATCHING_TAGS'); ?></span>
	</div>
	<?php endif; ?>
</div>
 

This Joomla 3 override allows you to display a list of articles with the same tag simply using the Joomla's mod_tags_similar module. At the bottom of this article, you can download the files of the override.

Joomla 3 frontend rendering

PhP markup

<?php
	/**
		* @package     Joomla.Site
		* @subpackage  mod_tags_similar
		* @Author 	   web-eau.net
		* @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
		* @license     GNU General Public License version 2 or later; see LICENSE.txt
	*/
	
	defined('_JEXEC') or die;
	
?>
<div class="tagssimilar<?php echo $moduleclass_sfx; ?>">
	<?php if ($list) : ?>
	<div class="row">
		
		<?php foreach ($list as $i => $item) : ?>
		<div class="col-4 my-1">
			
			<?php if (($item->type_alias === 'com_users.category') || ($item->type_alias === 'com_banners.category')) : ?>
			<?php if (!empty($item->core_title)) : ?>
			<?php echo htmlspecialchars($item->core_title, ENT_COMPAT, 'UTF-8'); ?>
			<?php endif; ?>
			<?php else : ?>
			
			<h5><a href="/<?php echo JRoute::_($item->link); ?>">
				<?php if (!empty($item->core_title)) : ?>
				<i class="fa fa-tag mx-2"></i>	<?php echo htmlspecialchars($item->core_title, ENT_COMPAT, 'UTF-8'); ?>
				<?php endif; ?>
			</a></h5>
			<?php endif; ?>
		</div>		
		<?php endforeach; ?>
	</div>
	<?php else : ?>
	
    <div class="alert alert-info" role="alert">
		<i class="fa fa-info-circle"></i> <span><?php echo JText::_('MOD_TAGS_SIMILAR_NO_MATCHING_TAGS'); ?></span>
	</div>
	
	<?php endif; ?>
</div>
 

web-eau.net

France - 29800 Landerneau

+33 674 502 799

daniel@web-eau.net

Quick links