Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • Add-ons
  • Module, Plugin & Snippet Usage
  •  
  • <
  • 1
  • 2
  • >
  • Tweet This Snippet#

  • 6659
    17
    MODx Development and Magento Development. Twitter: @Dave_Child

    DaveChild Reply #1, 2 years, 9 months ago

    Reply
    • Link to this post#1
    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:



    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
    740
    with regards,

    Ronald Lokers
    'Front-end developer' @ h2o Media

    ronaldlokers Reply #2, 2 years, 9 months ago

    Reply
    • Link to this post#2
    Nice, maybe will build it into my site, but shouldn't the @text be &text


  • 6659
    17
    MODx Development and Magento Development. Twitter: @Dave_Child

    DaveChild Reply #3, 2 years, 9 months ago

    Reply
    • Link to this post#3
    It should indeed - thanks for spotting that. I've changed it now.


  • 7231
    4,205
    Shane Sponagle | Snippet Call Anatomy | MODx Developer Blog | Working With a Content Management Framework: MODx

    Something is happening here, but you don't know what it is.
    Do you, Mr. Jones?  - 

    dev_cw Reply #4, 2 years, 9 months ago

    Reply
    • Link to this post#4
    Great snippet. Very cool.


  • 4971
    961
    Website: www.mercologia.com
    MODX Revo Tutorials:  www.modxperience.com

    MODX Professional Partner

    charliez Reply #5, 2 years, 9 months ago

    Reply
    • Link to this post#5
    Thanks, very nice snippet for Twitter availability...!!


  • 28033
    925
    My Snippets
    -> PopUpChunk v1.0

    Soshite Reply #6, 2 years, 9 months ago

    Reply
    • Link to this post#6
    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.


  • 6659
    17
    MODx Development and Magento Development. Twitter: @Dave_Child

    DaveChild Reply #7, 2 years, 9 months ago

    Reply
    • Link to this post#7
    Quote from: Soe 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
    151
    I'm a MODX web designer, I use also use FoxyCart for eCommerce projects - Follow me on Twitter.

    Adam Wintle Reply #8, 2 years, 9 months ago

    Reply
    • Link to this post#8
    Yeah this rocks! I'd love to see more things like this for MODx!


  • 26931
    2,242
    fancypants menu: http://modxcms.com/forums/index.php/topic,31940.0.html

    sharkbait Reply #9, 2 years, 9 months ago

    Reply
    • Link to this post#9
    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
    740
    with regards,

    Ronald Lokers
    'Front-end developer' @ h2o Media

    ronaldlokers Reply #10, 2 years, 9 months ago

    Reply
    • Link to this post#10
    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 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


  • <
  • 1
  • 2
  • >



Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
AdamWintle, DaveChild, Soshite, charliez, dev_cw, mrhaw, oldwebdude, ronaldlokers, sharkbait, sottwell, symb

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Work at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy