On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: sinbad at Jan 26, 2011, 05:10 PM

    @ sparrow, did u miss splittingred post above you?


    yes I did! Could you explain what the difference is and what the benefit is in using the alternative code?
    • I’m not sure there is any benefit other than readability. They both will give the same result so I think its yet another case of doing same thing in different ways.

      What I would love to see if the other options that scheme can take. searching the site leads me to opengeek’s post about the addition but can’t find where the docs for it.
      • Has anyone managed to create their own Facebook icon and hook
        it up to ModX? I’m not talking about the off-the-shelf FB button or
        the iFrame versions but your own graphic pulled from your own server.

        I have my own Facebook button under each blog post.
        I’d like people to click on it and for Facebook to know
        which page URL you are sharing.

        I know I could do this by using the
        [[!++site_url]][[~[[*id]]]]
        in the code somewhere but I can only get it to work when I hardwire a
        single URL into the code. That’s not really what I want as the code is
        a snippet.

        My code is below (I’ve omitted the actual URLs)

        <a href="http://www.facebook.com/sharer.php?u=http://www.mybigfatdomain.com/blog/recent-updates.php/&amp;t=Our+Blog" title="Share on Facebook" rel="nofollow" target="_blank"><img src="../assets/images/button_facebook.gif" alt="Facebook" /></a>

        I know the part of the above code which refers to the domain
        http://www.mybigfatdomain.com/blog/recent-updates.php
        could be replaced by something more elegant but nothing I have tried really works.

        Would appreciate any help.


        • <a href="http://www.facebook.com/sharer.php?u=[[~[[*id]]:urlencode? &scheme`full`]]" title="Share [[*pagetitle]] on Facebook" rel="nofollow" target="_blank"><img src="../assets/images/button_facebook.gif" alt="Facebook" /></a>


          I guess that would work.

          What this does...
          [[~[[*id]]:urlencode? &scheme`full`]]

          is make a link to the current page with the "full" scheme (so including the siteurl), and wrap it all up using the php urlencode function which escapes certain characters. I would expect that to be the problem you are/were facing.

          On my site I use the BookmarkThis addon to output different links in a simple popup, including facebook. There were a few changes I made to it - you can read about that on my site: http://www.markhamstra.nl/modx/addons/others/bookmarkthis.html

            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.