Page 1 of 1
Problems with Addthis
Posted: Sat May 23, 2009 10:29 am
by Mangek
I found
this thread by Don but I didn't want to bump it as it's pretty old. I tried the code Don posted with my username at addthis.com:
Code: Select all
<script type="text/javascript">
addthis_url = '{$entry.rdf_ident|escape:url}';
addthis_title = '{$entry.title|escape:url}';
addthis_pub = 'mangek';
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
and it works well when viewing a single entry, but on the frontpage it grabs the link from the last entry on the page. I see Don has this up and running fine on his site, so I'm thinking I may have placed it dodgy?
Please take a look and see if you can spot what I did wrong.
Edit: A slight update. I checked the source, and apparently the links are being printed correctly, however when I hover the button, the url shown is for the bottom-most entry. Clicking the button takes me to the right place and prints the right url though. But it feels a little missleading. :/
Edit2: Actually, when I'm looking closer, I'm experiencing the same thing over at Don's site. Maybe it's all good, then?

Re: Problems with Addthis
Posted: Mon May 25, 2009 10:19 am
by garvinhicking
Hi!
This code snippet always overwrites addthis_url with the title/name of the last used occurence, so this is a conceptual problem. You might want to ask the addthis! guys if there's a way so that their widget does not use the last occurence of a declared variable, but make those variables part of the URL, so that you would call:
Code: Select all
<script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12&url={$entry.rdf_ident|@escape:url}&title={$entry.title|@escape:url}&pub=mangek" ></script>
Regards,
Garvin
Re: Problems with Addthis
Posted: Mon May 25, 2009 9:48 pm
by Don Chambers
Hmmm.... either I never noticed that before, or they changed something about how that script works.... I will look into it later this week if time permits....
But you are saying it WORKS correctly, its just misleading when hovered, correct?
Re: Problems with Addthis
Posted: Tue May 26, 2009 4:21 pm
by Mangek
Don Chambers wrote:But you are saying it WORKS correctly, its just misleading when hovered, correct?
Correct.
Re: Problems with Addthis
Posted: Wed May 27, 2009 9:25 pm
by Don Chambers
By coincidence, AddThis came up with a new version of their code just this morning.
New code can be found in my blog post
here
The new version of the code is no longer misleading as to what will be bookmarked because the entry title and/or URL are not seen when the button is hovered.
I am using this new version on my primary site, and all tests proved successful so I committed a version of it to Bulletproof as well. Please let me know about any problems.
Thanks again Mangek for mentioning this since I had been meaning to update that code for quite some time!

Re: Problems with Addthis
Posted: Thu May 28, 2009 10:05 pm
by Mangek
Don, I'm now using your updated script and it looks better.
I also like the added support for the various images, I prefer 'share' over 'bookmark'. Big kudos to you, Don! And cheers to the Addthis-team for the update on their end.
Let's hope they add support for easy inserting the code from their site, that would rock!

Re: Problems with Addthis
Posted: Thu May 28, 2009 10:18 pm
by Don Chambers
Thanks - and so there is no misunderstanding, I did NOT write the actual script for the addthis button... I merely went to their site, reviewed how it worked with other CMS engines, then substituted in the s9y variables as needed. The buttons are also theirs..... I agree - I like the "share" button too and may switch my site to it as well.
Yes, it would be great if they would add s9y to their list of auto-generated scripts.. I offered to assist if they are willing to do that.
Re: Problems with Addthis
Posted: Thu May 28, 2009 11:04 pm
by Mangek
No I know, but it's still awesome!
