Comments on ShareThis Extension
Hey Jim... I made some slight modifications I made to the copy of ShareThis for my site. The idea was to make it a more self-contained extension to enable people to install it somewhere without having to add images to the styles directory. Here are the changes I made in case you'd want to make similar changes.
Created extensions/ShareThis folder. Put ShareThis.php in that folder In ShareThis.php created new global $wgShareThisScriptPath = $wgScriptPath . '/extensions/ShareThis';
unzipped pictures in archive to /extensions/ShareThis/icons
changed generated image sources to $wgShareThisScriptPath/icons/$name.png
As I have all the standard wikimedia extensions under extensions updated by svn, and I have the non-svn extensions under a different directory structure, my LocalSettings.php looks like this:
require_once('extensions_local/jimbojw/ShareThis/ShareThis.php'); $wgShareThisScriptPath = $wgScriptPath . '/extensions_local/jimbojw/ShareThis'; $wgShowShareThisSidebar = true;
Hope this helps!
--Charlie 00:07, 29 April 2007 (MST)
Oh and I also added facebook as recommended by tom, and added an icon for it. See http://charlie.huggardlee.net/downloads/mw_extensions/jimbojw/ShareThis/
--Charlie 00:17, 29 April 2007 (MST)
Hi Jim - love the extension. I am using it on my site. The only issue I get is when I try and validate the HTML from the w3c validation site. It looks like Google might not like validation error as its not picking up the site any more.
Error:required attribute "alt" not specified that is missing from img_src
Should I add the concatenation within:
"<img src='$wgStylePath/common/images/sharethis/$name.png' /> " .
Thanks!
Sean
--Sean 04:44, 10 May 2007 (MST)
Actually, look at this in more detail I would be surprised if thats what's causing me to disappear off Search engines ... probably something else, just coincidental timing
--Sean 06:13, 10 May 2007 (MST)
Hi Sean,
I'll have to look into that - I certainly don't want my extension to be causing sites to break their compliance contract.
--Jimbojw 08:13, 10 May 2007 (MST)
Hi there, Love the extension, thanks very much :)
If you look at my site I have been trying to figure out how to get the Share This sidebar onto the righ hand side under the adsense. I have a div set up but am at a bit of a loss as to what code needs to go in there.
Any help would be great :)
Thanks in advance
--Rob 12:24, 14 May 2007 (MST)
Hi Rob,
As of version 0.1.1, there's not a "good way" to do that, but here's something that might work for you:
<?php echo(wfShareThisParserHook(null, null, null)); ?>
Optionally, you can wrap that in a <div> with an identifiable class or id attribute.
Suppose you wrapped it in a div like this:<div class="share-links">...</div>
You could use this CSS to target the links to make them appear on their own lines:
.share-links a { display: block; }
OR, here's another solution (probably better now that I think about it)
<div class="whatever"> <ul> <?php wfInsertShareThisSidebar($template) ?> </ul> </div>
Then, go to the article titled "MediaWiki:share-this-toolbox-escape-html" and remove the content. That is, edit the article, enter nothing (or a single space) and save it.
That might get you closer to what you want.
If there's a wider demand for an easy way to configure the ShareThis links somewhere other than below the Toolbar, I may revisit as a feature request.
Thanks for your comment!
--Jimbojw 11:47, 15 May 2007 (MST)
Hey Jim... I upgraded my wiki version today and it seems that a combination of whatever they did somewhere between 1.10 and MW 1.11alpha r23396 and ShareThis breaks the wiki in a quite spectacular way (at least the sidebar component). I'll look into it more when I have some time and get back to you then, but thought I'd let you know about this issue.
--Charlie 10:47, 25 June 2007 (MST)
Hi Charlie,
There was recently a change in the way null return values are interpreted from extension hooks. Previously, nulls were evaluated in a boolean context and treated like false. Since this is almost never the intent of an extension, and since null is (and was never) an acceptable extension method return value, now when an extension returns null it bombs out in a so-called spectacular error.
This was occurring for ShareThis because the hooking method for MonobookTemplateToolboxEnd was returning a null value when the global "show in sidebar" flag was not set. I have corrected this, so if you redownload the extension, it *should* work just fine.
Please let me know if that doesn't resolve the issue, or if anything else goes horribly wrong. Thanks in advance!
--Jimbojw 23:21, 25 June 2007 (MST)
Hi,
I'm testing this nice extension. I added alt='$name' to both '<img src='-lines in ShareThis.php to get it Valid XHTML 1.0 Transitional.
Would be nice, if you put this into the next version.
Greetings from Germany,
Wilhelm
P.S: maybe this was Seans problem too with http://validator.w3.org/
--Wilhelm 09:07, 8 July 2007 (MST)
Is there a way to have it enabled for all pages in my wiki by default?
--Martin 03:18, 19 August 2007 (MST)
ok forget my point, it's always in the sidebar by default and the code on the article page adds them in a row below the article. :)
--Martin 07:21, 19 August 2007 (MST)
Also works in MediaWiki 1.11.0. I use this extension on the sidebar, with links non-decorated.
Neat extension.
--Wiki 20:56, 26 September 2007 (MST)
Is there a way to automatically add the sharethis icons to the body? It doesn't have to be in the actual body, but I'd like to automatically have it placed in that general area. Maybe in the category bar or beside the edit button.
--Eddron 21:48, 17 October 2007 (MST)
Hi Eddron,
The easiest way to do that is to put the following code fragment in your site's skin wherever you want the icons to appear:
<?php echo(wfShareThisParserHook( null, null, null ));?>
Note that this will make it appear on every page - even Edit views of pages and Special pages. You could limit the display by adding logic based on the $action and $wgTitle global variables if you felt so inclined.
Also, please see my earlier response to Rob about this for more details. Hope this helps!
--Jimbojw 09:31, 18 October 2007 (MST)
is there a way to put the ShareThis box below the language box? For my site, languages are more important than self promotion at this stage. --60.242.222.210 11:55, 1 December 2007 (UTC)
--naught101 04:58, 1 December 2007 (MST)
Hello naught101,
I'm not sure how your languages bar gets there in the first place. If you inserted it into your skin directly, then try moving it above the MonoBookTemplateToolboxEnd call (this is where ShareThis is inserted).
If your language bar is being inserted by another extension, try reordering the require() lines in your LocalSettings.php file such that ShareThis is above the one creating the Language bar.
Good luck!
--Jimbojw 14:01, 3 December 2007 (MST)
Jimbojw: The languages bar is a core feature of mediawiki. look at nearly every wikipedia article in the main namespace, it's there. Any interwiki link which has a short name in languages/names.php is included. I'm happy to create my own solution, I just thought you might know where to start.
--naught101 23:15, 4 December 2007 (MST)
Hi Jim,
Excellent work! However, are you aware of any problem of ShareThis working together with Halo extension? They are not compatible in my case, because Halo requires its own specific version of mediawiki and SMW.
--Jun 05:39, 5 December 2007 (MST)
naught101,
> The languages bar is a core feature of mediawiki.
Then you'll have to hack the MediaWiki core to change its behavior. I recommend changing wherein your skin the MonobookTemplateToolboxEnd hook is called - put it where you want ShareThis to go.
--Jimbojw 10:11, 5 December 2007 (MST)
Hi Jun,
I'm not very familiar with Project Halo, but it sounds like it may alter something in the core on which ShareThis depends.
Without digging into the Halo source code, I'm afraid I won't be of much help :/
--Jimbojw 10:23, 5 December 2007 (MST)
Please add Facebook to this extension. See http://www.facebook.com/share_partners.php
--Gordon Morehouse 05:44, 7 January 2008 (MST)
I tried installing according to instructions, but the images will not turn up on the page (links are there, but only in text).
--Martin S 03:01, 14 July 2008 (MST)
i installed the extension, i choose which services to appear in the "sharethis" box at the sidebar but i have the problem shown at the photo;
http://farm4.static.flickr.com/3168/2981750388_d087321f68_o.jpg
it seems that the extension merges with the "cite" extension and the "multiupload" extension. its links appear at the "sharethis" box.
any idea to resolve the problem?
--biris 08:30, 28 October 2008 (MST)
To add a facebook share link:
$wgShareThisSiteList['facebook'] = 'http://www.facebook.com/share.php?u=$1&title=$2';
That is for the text-only option.
--Tom 16:24, 28 April 2007 (MST)