We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38850
    • 110 Posts
    I have a container for a user menu and one of the options I want is just for logging out. I figure a symlink is great for this since I'll just link to the "login" page which uses the Login snippet with "service=logout" for the attributes.

    My issue is that, ok so I set the ID of the document to open, and create the attribute, but a few things don't make sense:

    1) There is still a freeze URI option which seems to override the purpose of a symlink in the first place, I can put whatever I want in here and then the ID and attributes on the first tab are ignored.

    2) Regardless if I use the main tab or the freeze URI option, the actual link looks like "/index.html?id=14". Shouldn't it instead point to the actual page or URI? This can be a problem should somebody copy the link or somehow create a bookmark or something this way. And why aren't the attributes in that link? I set an attribute of "service=logout" but it doesn't show up when I hover over this link in the browser, is it POSTed or something?

    3) My symlink is in a container, so it is actually pointing to the wrong document when I use it. In other words, I want to reach "/login.html?service=logout" but the actual URI it goes to is "/parent/login.html?service=logout".

    4) I thought perhaps I didn't need a symlink, but a weblink. I tried to use a weblink instead but this seems to force me to use a response code like 301 moved. I don't want a response code, I don't want weird looking links, I don't want funny business in how the link is displayed to users, all I want is just to link to another page!


    Assuming I don't want to hard-code the link, I'd rather let wayfinder build the menu; how can I just put a link that looks, behaves and performs like a regular old link?
      • 3749
      • 24,544 Posts
      This might be what you want (replace 12 with the ID of the Login page):

      <a href="[[~12? &service=logout]]">Logout</a>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 38850
        • 110 Posts
        Quote from: BobRay at Oct 20, 2014, 05:44 PM
        This might be what you want (replace 12 with the ID of the Login page):

        <a href="[[~12? &service=logout]]">Logout</a>

        For some reason the link tag isn't working as expected either. The method you used still creates something like "/index.php?id=12?service=logout".
        Notice the two "?" in there.

        I also tried

        < href="[[~12]]?service=logout">


        This method also produces two "?". So I replaced the question mark with an "&" and this seems to create a proper URL like "/index.php?id=12&service=logout" but the "service" attribute was just dropped right off. It takes me the ID 12 page but the attribute is of no effect and is no longer in the address bar.

        FURL is on, as well as use alias paths. But the link tag is just broken, why does it take me to "index.php?id=xx" instead of to the actual FURL/alias/freeze URI like one might expect? And why does it ignore or drop off any attributes I try to use?

        Really strange!
          • 3749
          • 24,544 Posts
          I've seen this code used. It sounds like you tried it (though you're missing the first 'a' in your example above):

          <a href="[[~12]]&service=logout">Logout</a>


          The link produced by Login itself looks like this on my localhost site (the site is in the addons subdirectory just below the web root):

          <a href="/addons/login.html?service=logout" title="Logout">Logout</a>
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Maybe it should be
            [[~12? &service=`logout`]]
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 38850
              • 110 Posts
              Quote from: sottwell at Oct 21, 2014, 01:45 AM
              Maybe it should be
              [[~12? &service=`logout`]]

              This is the correct method. I don't know why but I had thought the [[~12]] notation would simply echo a link and I would put attributes after it but that is not the case.

              In any case I got the STATIC link working from my chunk, because neither the symlink nor the weblink were able to fill this need.

              I also uncovered an interesting quirk where, if the link is pointing to a page that the user may not have access to, it creates a non-FURL link to the user. So one user who DOES have access sees "page.html?some=thing" while the user who doesn't have access will see "index.html?id=12&some=thing".
              I don't know if this is a bug or a feature, but bottom line is that "[[~12]]" will create a different link for different people!