We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15175
    • 116 Posts
    I’m trying to return the full URL of the current page to put a link in a third-party button. It needs to work if friendly URL’s are on.

    I think this is probably very simple, but I’m going round in circles here.



      • 15175
      • 116 Posts
      Why do I always seem to work things out five minutes after posting a question?

      Snippet name [[ThisPageURL]] :

      <?php
      $url = $modx->makeUrl($id, '', '', 'full');
      return $url;
      ?>


      Snippet call:

      [[ThisPageURL? &id=`[*id*]`]]


      smiley
        • 33337
        • 3,975 Posts
        As long as you post your solution too, we are good with it. wink

        All the best.
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 15175
          • 116 Posts
          Cheers zi. I think there must be something in the process of actually writing down an issue that frees up a few braincells.
            • 21438
            • 10 Posts
            ...or with MODx tags:

            [(site_url)][~[*id*]~]
              • 20995
              • 6 Posts
              Thanks for that little code! Now it’s even easier to put together a simple facebook "like" link that checks out under w3c.

              <iframe src="http://www.facebook.com/plugins/like.php?href=[(site_url)][~[*id*]~]&layout=standard&show_faces=false&width=450&action=like&font&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:2.0em"></iframe>
              
              • Quote from: natethomas at May 11, 2010, 08:07 PM

                Thanks for that little code! Now it’s even easier to put together a simple facebook "like" link that checks out under w3c.

                <iframe src="http://www.facebook.com/plugins/like.php?href=[(site_url)][~[*id*]~]&layout=standard&show_faces=false&width=450&action=like&font&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:2.0em"></iframe>
                


                I was looking at this for JUST THIS REASON. Awesome smiley
                  Sal Baldovinos
                  SEO & DIGITAL MARKETING

                  ARIEL DIGITAL | Maximize Your Potential
                  www.arieldigitalmarketing.com
                  • 46107
                  • 1 Posts
                  Hi Guys,

                  Great solutions but in my opinion there is a far easier way to do it.

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



                    • 39501
                    • 163 Posts
                    @rottitime +1 !
                      • 3749
                      • 24,544 Posts
                      Or the snippet version:

                      [[!ThisFullUrl]]


                      /* ThisFullUrl Snippet */
                      $DocId = $modx->resource->get('id');
                      return $modx->makeUrl($docId, "", "", "full");
                        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