We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6659
    • 18 Posts
    This snippet returns a link to twitter for the user to tweet the a URL (current page by default) with its title. URL is TinyURLed automatically (and tinyurls are cached indefinitely in assets/cache/tweetthis.txt).

    Usage

    Simply paste code (in attached file) into a new snippet called "TweetThis". Call it like so:

    [[TweetThis? &name=`@DaveChild` &text=`Tweet This!` &id=`7` ]]

    Parameters (all parameters are optional).

    &name - can be your Twitter ID if you prefix with "@".
    &text - will default to "Tweet This!".
    &id - will default to the current document id.

    Updates

    Update 0.2 - more efficient storage of tinyurls (using id rather than url as key).
    Update 0.3 - added id as optional parameter.
    Update 0.4 - added check to ensure id is numeric. If not, snippet writes error to event log and uses default document id instead.
      • 25483
      • 741 Posts
      Nice, maybe will build it into my site, but shouldn’t the @text be &text tongue
        with regards,

        Ronald Lokers
        'Front-end developer' @ h2o Media

        • 6659
        • 18 Posts
        It should indeed - thanks for spotting that. I’ve changed it now.
          • 7231
          • 4,205 Posts
          Great snippet. Very cool. cool
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 4971
            • 964 Posts
            Thanks, very nice snippet for Twitter availability...!!
              Website: www.mercologia.com
              MODX Revo Tutorials:  www.modxperience.com

              MODX Professional Partner
              • 28033
              • 925 Posts
              Would it be possible to allow for giving a specific ID?

              For instance, this doesn’t work on content gathered by Ditto. If I could specify the ID, I could get it to work on my front page. wink
                My Snippets
                -> PopUpChunk v1.0
                • 6659
                • 18 Posts
                Quote from: Soshite at Apr 17, 2009, 07:41 PM

                Would it be possible to allow for giving a specific ID?

                Done. Updated to 0.3 and you can now pass in an ID. I actually had it set to do that originally and changed it to keep it simple, but it makes sense to have the ability to pass in an id as well.
                  • 436 ☆ A M B ☆
                  • 265 Posts
                  Yeah this rocks! I’d love to see more things like this for MODx! grin
                    MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                    • 26931
                    • 2,314 Posts
                    thank you for sharing!

                    sorry to ask, i’m not sure if i understand the use of this snippet...it produces a tinyurled link & title, so that the user can copy and paste the text in order to tweet it?

                    jan
                      • 25483
                      • 741 Posts
                      Quote from: sharkbait at Apr 18, 2009, 06:40 AM

                      thank you for sharing!

                      sorry to ask, i’m not sure if i understand the use of this snippet...it produces a tinyurled link & title, so that the user can copy and paste the text in order to tweet it?

                      jan

                      You almost get it wink You will get a link to twitter with the tinyurled link & title so you only have to log in into twitter to tweet the message smiley
                        with regards,

                        Ronald Lokers
                        'Front-end developer' @ h2o Media