We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6659
    • 18 Posts
    Quote from: sharkbait at Apr 18, 2009, 06:40 AM
    sorry to ask, i’m not sure if i understand the use of this snippet

    It outputs a link, like the one following, that the user can click to take them to Twitter, where they’ll see the "post" field pre-populated with the title of the page, a TinyURLed link to the page, and your name or Twitter id:

    <a class="tweetthis" href="http://twitter.com/home?status=Title+of+Post%20by%20%40UserName:%20http%3A%2F%2Ftinyurl.com">Tweet This!</a>
      • 26931
      • 2,314 Posts
      smiley aaaah - okay, get it, thank you!

      jan
        • 28033
        • 925 Posts
        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « `` is not numeric and may not be passed to makeUrl() »

        Parser timing
          MySQL: 0.0056 s (19 Requests)
          PHP: 0.1780 s
          Total: 0.1837 s

        When using...

        [[TweetThis? &name=`@talesunion` &text=`Tweet this news story!` &id=`[~[+id+]~]`]]</span>

        ...[~[+id+]~] being how Ditto grabs that page’s ID.
          My Snippets
          -> PopUpChunk v1.0
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          [~[+id+]~] would result in a URL, definitely the cause of your "not numeric" error! Why not just [+id+] if all you want is the docID?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 6659
            • 18 Posts
            Quote from: Soshite at Apr 18, 2009, 04:53 PM
            « MODx Parse Error »

            As Susan pointed out, the error was caused because you passed a URL in rather than an ID. I’ve updated the code above now to check the id passed in is numeric. If not, it logs the error to the event log and defaults to the current page ID.

            Also, if you’re passing in the current document id, you might as well leave &id out altogether - it will use the current document id by default anyway.
              • 28033
              • 925 Posts
              Quote from: sottwell at Apr 19, 2009, 01:30 AM

              [~[+id+]~] would result in a URL, definitely the cause of your "not numeric" error! Why not just [+id+] if all you want is the docID?

              Quote from: DaveChild at Apr 19, 2009, 02:58 AM

              As Susan pointed out, the error was caused because you passed a URL in rather than an ID. I’ve updated the code above now to check the id passed in is numeric. If not, it logs the error to the event log and defaults to the current page ID.

              Also, if you’re passing in the current document id, you might as well leave &id out altogether - it will use the current document id by default anyway.

              It’s due to Ditto. If I left out the ID, it would default to the home page for every news article. And IIRC, that code needs to be used by Ditto to pass in the ID of the article it’s grabbing.

              Although I can see if the other version works.
                My Snippets
                -> PopUpChunk v1.0
                • 22120
                • 21 Posts
                WOOT! Thanks to DaveChild and help with docid from Susan for an awesome snippet that works like a charm!

                As a newb to MODx this is the first snippet I actually got working - other attempts (cumulus and poll) were not so successful and a bit disheartening.

                I’d recommend this snippet to other newbs looking for a boost into understanding incorporating extras. Now if I could just get those others figured out... wink

                Thanks again DaveChild! grin
                  • 28033
                  • 925 Posts
                  How come longtitle doesn’t work, and only pagetitle does?
                    My Snippets
                    -> PopUpChunk v1.0
                    • 29087
                    • 4 Posts
                    Thank you for this snippet, DaveChild. The caching of tinyurls is pretty nice and clever.
                    Keep up the good work.

                    //symb
                      • 20413
                      • 2,877 Posts
                        @hawproductions | http://mrhaw.com/

                        Infograph: MODX Advanced Install in 7 steps:
                        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower