• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

AddThis - Carrying over thread title information?

#1
Hi All,

I have XenPorta installed and I want to have the AddThis sharing buttons on RecentNews posts. The AddThis buttons work however they do not carry over the thread/news title when clicked.

HTML:
<div class="shareControl" style="width:107px">
<div class="addthis_toolbox addthis_default_style ">
    <a class="addthis_counter addthis_pill_style" addthis:url="{xen:link canonical:threads, $news}" {xen:if {$thread.title}, 'addthis:title="{xen:helper threadPrefix, $thread, escaped}{$thread.title}"'}></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fbae4826478f92e"></script>
</div>
Website:

www.HackSlashRepeat.com - Look for the orange buttons along the RecentNews entries on the home page.
 

Jake Bunce

XenForo moderator
Staff member
#2
I don't use addthis myself, but in looking at XenForo's usage it appears to require a URL.

Code example:

Admin CP -> Appearance -> Templates -> post_permalink

Code:
					<xen:include template="addthis_ajax">
						<xen:set var="$url">{xen:link full:threads/post-permalink, $thread, 'post={$post}'}</xen:set>
					</xen:include>
Then in the addthis_ajax template you can see how the url is used:

Code:
var addthis_share = {
	url: "{xen:jsescape $url}",
	templates: {
		twitter: "{{title}} {{url}}{xen:if {$xenOptions.tweet.via}, ' via @{$xenOptions.tweet.via}'}"
	}
};
Hopefully that helps.
 
#3
Hi Jake,

Sorry for the long delay, I have been traveling a lot lately. I have had a look at the code but it's a bit advanced for me to figure out the "next step". Is there some line of code that I should be modifying or adding etc to one of the templates?

I appreciate your help.


Regards,

Greg