Joomla/K2 Tags Mod

Just a quick fix for a tag link issue I came across.

broken url:
domain.com/tag/two word.html

if you take the spaces in the URL and replace them with pluses (‘+’) it’ll work. For example:

fixed url:
domain.com/tag/two+word.html

tested and working on Joomla 1.5.15, with K2 2.1 and sh404sef 1.0.20_Beta – build_237

below is this file: /modules/mod_k2_tools/tmpl/tags.php
but it’s the same basic fix for the other files:
/components/com_k2/templates/default/item.php
/components/com_k2/templates/default/category_item.php

the key part is: <?php echo str_replace(' ','+',$tag->link); ?>

<?php
/*
// "K2 Tools" Module by JoomlaWorks for Joomla! 1.5.x - Version 2.1
// Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved.
// Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
// More info at http://www.joomlaworks.gr and http://k2.joomlaworks.gr
// Designed and developed by the JoomlaWorks team
// *** Last update: September 9th, 2009 ***
*/
//*****/
//the key part is: `<?php echo str_replace(' ','+',$tag->link); ?>`
//*****/
// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock <?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($tags as $tag): ?>
<?php if(!empty($tag->tag)): ?>
<a href="<?php echo str_replace(' ','+',$tag->link); ?>" style="font-size:<?php echo $tag->size; ?>%" title="<?php echo $tag->count.' '.JText::_('items tagged with').' '.$tag->tag; ?>">
<?php echo $tag->tag; ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>

One thought on “Joomla/K2 Tags Mod”

Leave a Reply

Your email address will not be published. Required fields are marked *