We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36648
    • 19 Posts
    I'm having some trouble trying to get the current window ressource ID. Not the page, but the real windows url showing.
    The
    [[*id]]
    returns the active page id, like in javascript "document.location.href".
    I'm looking for window.location.href

    Any idea ? [ed. note: duk3fy last edited this post 12 years, 6 months ago.]
      • 3749
      • 24,544 Posts
      I might be misunderstanding you, but I think you want this:

      [[~[[*id]]? &scheme=`full`]]


      Depending on what you want it for, this might work as well:

      [[~[[*id]]]]
        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
        • 36648
        • 19 Posts
        Hi Bobray, thanks for you answer.

        Maybe I didn't made myself clear. All those formattings of
        [[*id]]
        are returning current active page's id. I'm looking for the real path, contained in the url bar.

        I refered to javascript because this explains perfectly the problem, but in others words:
        [[*id]]
        returns the id of the page (resource) in wich it is called. Using this with frame or popin calling external page as content, the resource returned is different from what appears in the adress bar, the real path.

        I'm really needing this, did anyone ever being face to that question ? [ed. note: duk3fy last edited this post 12 years, 6 months ago.]
        • The outer tag BobRay was showing you takes the id and turns it into the URL for accessing that Resource according to your FURL settings.
            • 36648
            • 19 Posts
            Hello opengeek,

            The problem isn't the syntax of the link returned, but the ID returned itself.

            All those
            [[*id]] [[~[[*id]]? &scheme=`full`]] [[~[[*id]]]]
            are returning the active page's ID. I'm looking for the real path, the one shown in the browser URL's field at the moment. It differs from the active page's URL when calling popups, using frames, loading via ajax with external pages calls ...

            I definitly didn't find anything in the doc.
            Thank you
              • 33968
              • 863 Posts
              I take it you want the current page url, but you want it loaded within an iframe or some content loaded via ajax. In that case you won't be able to use the above tags but will need to pass the current resource ID to the new content.

              Maybe you need to explain a little more about what you are doing so we can give you a more specific answer...
                • 3749
                • 24,544 Posts
                I'm not sure if this would work, but you might try a snippet:

                [[!GetUri]]


                /* GetUri snippet */
                return $_SERVER['REQUEST_URI'];
                  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
                • Magnatron [Maarten Wolzak] Reply #8, 12 years, 6 months ago
                  It seems you want to do something on the server side which takes place on the client side: The server has no idea if the requested resource is within a frame or not. Therefor the server also does not know what URL is in the address bar.

                  If you are, as it seems, referring to frames or ajax you could try using the
                  $_SERVER["HTTP_REFERER"]
                  environment variable but don't be depending on it to work well in every situation.

                  Lucas's answer is better: pass the current resource ID on to the requested page as in:

                  <iframe src="theUrlOfYourIframe?comingfrom=[[*id]]"></iframe>