Tag problem

If I created a tag with 2 words, the tag link search is broken.

If I click on the tag, I get:

site.tld/page/search/tags/"something+something"

This result in a not found page.

In 1.4 (I believe) it was working fine.

Comments

  • acrylian Administrator, Developer
    Check your search options.
  • Can you provide a bit more information? Where is this link you are clicking on?
  • Tuto Member
    I checked the search options, I changed some stuff, no result.

    The links I click on are generated by printTags and printAllTagsAs.

    If I click on a tag with 2 words I get the link

    /page/search/tags/"something+something" (this result in a not found page)

    instead of

    /page/search/tags/something+something (this is how it used to work)

    Also the name output of printAllTagsAs uses "" with 2 word tags, something it never did before:

    tag1 tag2 tag3 "something something" tag5
  • Tuto Member
    With IE I get:

    /page/search/tags/%22something+something%22

    With Firefox and Chrome:

    /page/search/tags/"something+something"
  • I think you are wrong about two word tags not being quoted in the past. They would never have worked at all if not quoted. Without the quotes it is the same as two tags independent of each other.

    Anyway, both the links you show are correct links. Both will translate to "something something" when processed by the PHP post/get functions.

    However, maybe you have the PHP magic_quotes set? It is possible that there is a bug if that is set. We never run with that setting so would not notice.

    If you are not using the nightly builds you should install it. It is possible that you are seeing a different problem with search--field confusions--that has been fixed.
  • Tuto Member
    You're right it's probably a magic_quotes issue. I've got it now working on my localhost. I thought I had turned of magic quotes on my webhost, but phpinfo keeps saying it's on, no mather what I add in .htaccess

    The problem that printAllTagsAs outputs "" in two worded tags stays, it might be a minor bug or intended, but the "" weren't there before I upgraded.

    tag1 tag2 tag3 "something something" tag5 "something2 something2"
  • As I have said before. Without some kind of quatation around the string the search cannot work. Maybe the quotation marks differd (single quote, back tick) but without some quotation delimiter or the Spaces as space option these words are and always would have been treated as separate tags.

    Of course if "exact match" is also not set, maybe you find the same results.
  • Tuto Member
    yes, I know now.

    but I'm talking about about printAllTagsAs, not about the links they are fine, but about the vissible name output. it now looks like:

    tag1 tag2 tag3 "something something" tag5 "something2 something2"

    <...>"something something"

    while before it was without the ""

    there are no "" with printTags in the names
  • acrylian Administrator, Developer
    Indeed they are. Seems the tag is escaped for the search link and then the escaped one is used for display as well. Not sure if that is on purpose...
  • I have the same problem as Tuto.

    The searchform work fine with tags in two words.

    I have changed the search_quote function (called by printAllTagsAs) (in /zp-core/class-search.php)

    `

    function _search_quote($word) {

    if (is_numeric($word) || preg_match("/[ &|!'\"`,()]/",$word)) {

    $word = '"'.addslashes($word).'"'; //change this line

    }

    return $word;

    }

    `

    Replace the " by `
  • I guess I still do not understand. The quotation marks indicate that text is a single item. Leaving them off would lead people to think each word was an individual tag.

    Why is a single quote more pleasing to you than the double quotes? Anyway, your change may well cause downstream problems, specially if the string are used in javascript parameter lists. Besides, you will have to make this change each time you update.
  • Tuto Member
    With CSS you can easily seperate the tags visibly, you dont need "" for that. Now the tagcloud looks a bit strange when multiple-word-tags have "... ..." and single-word-tags have not.

    And it is not consistance, since printTags has no "" for multiple-word-tags.
  • Then I would have expected a different solution from what you presented. Probably you should modify the printAllTagsAs() function rather than the search_quote() function. That way at least you will not have any side effects of the change.
  • Personally, I added a printAllTagsAsMOD and a search_quoteMOD in my theme-functions.php
    (search_quote is called by printAllTagsAs)
    Bad but work as I expect.

    >> Why is a single quote more pleasing to you than the double quotes?

    because it's like the searchform work, no ?
    Start to enter a two-word-tags in the searchform, then click the two-word-tags suggested.
    The tag is quoted by simple quote and the search work fine.

    With printAllTagsAs, the multiple-word-tags are quoted by doublequote and the search don't work.
  • acrylian Administrator, Developer
    The quotation marks indicate that text is a single item. Leaving them off would lead people to think each word was an individual tag.
    Not sure if that is the case since normally tags are used as links so it is quite obvious on hovering if two works make one tag.
  • Tuto Member
    [blockquote]Then I would have expected a different solution from what you presented. Probably you should modify the printAllTagsAs() function rather than the search_quote() function. That way at least you will not have any side effects of the change.[/blockquote]

    Someone else joined the discussion, the modification is not mine.

    I thought the quotation marks in the URLS were the problem, but I was wrong, it was a magic_quotes issue. The URLS are working fine now with quotation marks.

    My only problem now is that printAllTagsAs prints multiple-word-tags like:

    `<...>"something something"`

    This happend since I updated (from 1.4 to 1.4.1). Single-word-tags have no quotation marks, so the tagcloud looks a bit messy now.
  • acrylian Administrator, Developer
    The comment was not addressed at you. As I said that functions uses `search_quote()` around a tag which is needed for the search itself. But it also displays that directly in the tag list. Not needed IMHO for display.

    We probably will change that but until then you should create your own function from that.

    UPDATE: Is already in the nightly build.
Sign In or Register to comment.