We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26975
    • 26 Posts
    Apologies ahead of time since I have stumbled by this problem on the forums before, but I haven’t found it again in the past two days of searching.

    Is there some already existing snippet/variable/whatever that will identify whether a URL should be seperated from its arguments by a question mark(?) as opposed to an ampersand(&)?

    <a href="[~1~]?you=cool">foo</a>
    <a href="[~1~]&you=cool">foo</a>
    
    <a href="[~id~][[sep]]you=cool&me=cool">foo</a>


    Our sandbox doesn’t match our live server, and switching back and forth would be a hassle. I figure that it’d be simple enough to write a snippet to check if FURLs are active, but if it exists already, why bother? smiley
    Thanks.
      • 26435
      • 1,193 Posts
      Technically the FriendlyURL is taken care of by apache’s mod rewrite of index.php?id=xx, so passing it another ? might break it’s delicate brain. I have passed some _GET parameters in a snippet before using [~[*id*]~]&param=value&param2=value2 and apache correctly rewrites it according to your friendly URL / Friendly Alias Path settings.

      -sD-
      Dr. Scotty Delicious, Scientist DFPA.
        Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
        All of the above... in no specific order.


        I send pointless little messages
        • 26975
        • 26 Posts
        So apache will automatically go from
        [~id~]&bar=foo
        to
        alias.html?bar=foo
        ? If so, I feel really stupid.
          • 22303 MODX Staff
          • 10,725 Posts
          Technically, the URL will have the ?, but since it is being rewritten by mod_rewrite, you will only see the additional parameters appended afterwards. I’ve found absolutely no problem with doing it that way (e.g. [~[*id*]~]&param=foobar), despite the apparent lack of a ? in the final URL displayed to the user. Using a ? will break it if you don’t have FURL’s enabled, otherwise, that will work fine as well.
            • 26975
            • 26 Posts
            Thanks for the clarification. I feel foolish.