PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Question: URL format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question: URL format

    http://www.site.com/search/search.php?zoom_query=%22search+term%22&x=15&y=7

    The url we typically use is as above.

    We need to implement that url within a content manager, so it would now look like this:


    http://www.site.com/search/search.php?zoom_query=%22$article.art_field1$%22&x=15&y=7

    The problem now is, without the "+" in the search term (between multiple words), we get
    inaccurate results.

    Is there a workaround?

    Thanks much.
    Jim

  • #2
    I don't really understand the situation nor the problem.
    What is $article.art_field1$ ?
    Why are you trying to "implement that url within a content manager"? What is the purpose?

    Comment


    • #3
      Sorry, more detail:

      $article.art_field1$ -- contains the author first and last name.

      Purpose -- we've created a "See more titles by this author" link.

      Problem --
      If the author's name is Bob Smith, the search results will
      display all "Bob" names -- because there is no "+" between
      first and last names.

      So, using our variable that contains both first and last names,
      is it possible to return the exact phrase?

      Thanks.

      Comment


      • #4
        If your content management system has a variable (I assume in PHP or the like) and you want this variable to form part of a URL, then the variable needs to be encoded.

        There are a limited number of characters that are allowed to be in a URL, and there are special reserved characters, like the question mark and the at "@" symbol.

        If you need the details look up the rfc1738 standard.

        This is what the standard says about space characters in a URL.

        "Characters can be unsafe for a number of reasons. The space
        character is unsafe because significant spaces may disappear and
        insignificant spaces may be introduced when URLs are transcribed or
        typeset or subjected to the treatment of word-processing programs.
        The characters "<" and ">" are unsafe because they are used as the
        delimiters around URLs in free text; the quote mark (""") is used to
        delimit URLs in some systems. The character "#" is unsafe and should
        always be encoded because it is used in World Wide Web and in other
        systems to delimit a URL from a fragment/anchor identifier that might
        follow it. The character "%" is unsafe because it is used for
        encodings of other characters. Other characters are unsafe because
        gateways and other transport agents are known to sometimes modify
        such characters. These characters are "{", "}", "|", "\", "^", "~",
        "[", "]", and "`".

        All unsafe characters must always be encoded within a URL."

        Comment


        • #5
          Originally posted by jmueller0823 View Post
          Problem --
          If the author's name is Bob Smith, the search results will
          display all "Bob" names -- because there is no "+" between
          first and last names.
          Maybe I'm missing something but can't you address that by simply doing a str_replace() call to replace " " with "+" on your field name prior to inserting it into the URL?
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            Maybe I'm missing something but can't you address that by simply doing a str_replace() call to replace " " with "+" on your field name prior to inserting it into the URL?
            I think what's needed is this:

            $article.art_field1$ = John Smith

            Change above to John+Smith

            Essentially, we need to insert "+" character(s) in the
            spaces between words.

            Would a php function do that?

            Thanks guys.

            Comment


            • #7
              Just a wild guess, but maybe the PHP function str_replace() might do it.

              Comment

              Working...
              X