Keyword

Leading space in tags

More
14 years 8 months ago #77303 by mihha
Leading space in tags was created by mihha
Hi,

when you (by accident) add a leading space to a tag, on the K2 Tools module showing tags, clicking on the tag itself doesn't get you to the article in which this tag is defined. It just takes you to the page that lists articles by the selected tag but this page is empty

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #77304 by Justin White
Replied by Justin White on topic Leading space in tags
We were having issues with duplicate tags, one having an inadvertant space. To fix this we edited /administrator/components/com_k2/models/item.php

We changed line 579 to:

$tag = str_replace('-','',$tag);

// MMJ hack removes leading and trailing and double spaces before checking to see if tag already exists
$pat[0] = "/^\s+/";
$pat[1] = "/\s{2,}/";
$pat[2] = "/\s+\$/";
$rep[0] = "";
$rep[1] = " ";
$rep[2] = "";
$tag = preg_replace($pat,$rep,$tag);
$tag = strtolower ($tag);

Suit your self if you want the last line, which forces tags to be lowercase. We are using k2 2.4.1

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum