Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Add To Any

Go to End



Community Member, 6 Posts

3 September 2009 at 7:45pm


Just knocked this up for a client's site and thought someone else out there might like it, perhaps want to improve it.

Code for adding an "Add To Any" button on your blog.

See what it does and looks like here:

Add this to your BlogEntry class (not the controller) in BlogEntry.php

	/* Chris Bolt added this to display an AddToAny button in templates. To display use $AddToAny */
	function AddToAny () {
		return '<a class="a2a_dd" href="'.urlencode(htmlspecialchars($this->Title)).'&amp;linkurl='.htmlspecialchars(urlencode(Director::absoluteURL(false))).'"><img src="" width="171" height="16" border="0" alt="Share/Save/Bookmark"/></a><script type="text/javascript">a2a_linkname="'.addslashes($this->Title).'";a2a_linkurl="'.addslashes(urlencode(Director::absoluteURL(false))).'";a2a_onclick=1;a2a_show_title=1;</script><script type="text/javascript" src=""></script>';

Then in your BlogEntry template ( simply put $AddToAny
I put it just below the blog entry.

have fun.