Joomla K2 Tags Mod


/ Published in: PHP
Save to your folder(s)

Just a quick fix for a tag link issue I came across.\r\n\r\nbroken url:\r\ndomain.com/tag/two word.html\r\n\r\nif you take the spaces in the URL and replace them with pluses (‘+’) it’ll work. For example:\r\n\r\nfixed url:\r\ndomain.com/tag/two+word.html\r\n\r\ntested and working on Joomla 1.5.15, with K2 2.1 and sh404sef 1.0.20_Beta – build_237\r\n\r\nsource shows this file: /modules/mod_k2_tools/tmpl/tags.php\r\nbut it’s the same basic fix for the other files:\r\n/components/com_k2/templates/default/item.php\r\n/components/com_k2/templates/default/category_item.php


Copy this code and paste it in your HTML
  1. <?php
  2. /*
  3. // "K2 Tools" Module by JoomlaWorks for Joomla! 1.5.x - Version 2.1
  4. // Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved.
  5. // Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
  6. // More info at http://www.joomlaworks.gr and http://k2.joomlaworks.gr
  7. // Designed and developed by the JoomlaWorks team
  8. // *** Last update: September 9th, 2009 ***
  9. */
  10. //*****/
  11. //the key part is: `<?php echo str_replace(' ','+',$tag->link); ?>`
  12. //*****/
  13. // no direct access
  14. defined('_JEXEC') or die('Restricted access');
  15.  
  16. ?>
  17.  
  18. <div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock <?php echo $params->get('moduleclass_sfx'); ?>">
  19. <?php foreach ($tags as $tag): ?>
  20. <?php if(!empty($tag->tag)): ?>
  21. <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; ?>">
  22. <?php echo $tag->tag; ?>
  23. </a>
  24. <?php endif; ?>
  25. <?php endforeach; ?>
  26. <div class="clr"></div>
  27. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.