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.
It should indeed - thanks for spotting that. I’ve changed it now.
Thanks, very nice snippet for Twitter availability...!!
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
-
☆ A M B ☆
- 265 Posts
Yeah this rocks! I’d love to see more things like this for MODx!
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
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