"The Get the Button code provided by ShareThis. If this is not given, the default one will be used."

I created a custom button at http://www.sharethis.com but am then given two pieces of code, one to go in and one to go in . What of this code do I enter at /admin/settings/sharethis in the single code entry area?

I tried the supplied code and bad things happened.
I tried the supplied code and bad things happened.

I will explain "bad things" further if necessary, but it shouldn't be.

Comments

hmmdinger’s picture

Category: support » feature

i have figured out that the admin area of this module is only set up for code for the more basic ShareThis button, for which there is only one chunk of code.

I had been trying to implement the "Multiple Icons" form of the button, which seems to generate two chunks, and would therefore involve directly modifying the module code.

The different button options can be seen at http://sharethis.com/publishers/getbutton

I am recategorizing this as a feature request to add support for the Multiple Icons version of the widget.

slicedsoup’s picture

I'd like to second that feature request. Also the documentation regarding the code that should be used from the STAPI should be updated to state which piece of code can and should be used and what limitations there are currently regarding the use of multiple icons. Adding the wrong piece of code gave me a white screen.

slicedsoup’s picture

It seems that the current development version offers a solution to provide multiple buttons.

yrre7’s picture

subscribe

ycwjjjj’s picture

subscribe

LPecunia’s picture

subscribe

Macronomicus’s picture

You could put the js code in the header of your page.tpl and the other code in your node.tpl with some properly limiting if statements and be done with it no modules needed, done in 5 min.

Matt Giacomazzo’s picture

subscribe

makangus’s picture

I ended up following #7 @macrocosm
More specifically, I put the javascript in page.tpl.php and the following code in node_content-type.tpl.php

<?php
global $base_url;
?>
<span class="st_email" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_facebook" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_twitter" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_sharethis" displayText="ShareThis" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span>
mareczko’s picture

Hi I'm new, never have programmed in php, so sorry for stupid questions!

I followed #9 makangus, and it worked fine, although I would like icons not to appear in teasers, only in full view of the mode.
How to accomplish it?

I tried putting ($page) (found this node.tpl handbook): in global $base_url; , so i ended with:

global $base_url; ($page):

but it didn't work out.
Could you give me any hint?
thanks in advance!

mareczko’s picture

I managed it myslef!.

In order to display share icons only in full view of a node you 've got to add

if ($page): 

to your code. So the code of node.tpl.php finally looks like that in my case (notice, that I've changed few of the icons...):

if ($page): 

print $base_url . $node_url; " st_title=" print $title; "> print $base_url . $node_url; " st_title=" print $title; "> print $base_url . $node_url; " st_title=" print $title; "> print $base_url . $node_url; " st_title=" print $title; "> print $base_url . $node_url; " st_title=" print $title; "> endif;

mareczko’s picture

I managed it myslef!.

In order to display share icons only in full view of a node you 've got to add

<?php
if ($page): ?>
to your code. So the code of node.tpl.php finally looks like that in my case (notice, that I've changed few of the icons...):
<?php
if ($page): ?>
<span class="st_facebook" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_twitter" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_blogger" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_wordpress" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_email" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span> <?php endif; ?>
xeraseth’s picture

Using the code from #12 (well edited since he kind of messed up the code tag I get this when I go to share a URL

http://www.facebook.com/sharer.php?u=http://shar.es/Xad5e&t=Wedding+Invi...

By looking at other share links the "http://shar.es/Xad5e&t=" should be the url of my site.

Here is the code in my node.tpl

<?php
if ($page): ?>
<span class="st_facebook" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_twitter" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_blogger" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_wordpress" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span><span class="st_email" st_url="<?php print $base_url . $node_url; ?>" st_title="<?php print $title; ?>"></span> <?php endif; ?>

and the code in the header of the page.tpl

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher:'feb099f8-36bd-4810-be4e-1b6c646b6bac'});</script>

shaneonabike’s picture

+1 I agree it's not that flexible and being able to add more buttons or having it more flexible seems to make sense. I ended up not using this module in the end.

jvalencia’s picture

I would recommend using the backport from Drupal 7:
http://drupal.org/node/1253794

avpaderno’s picture

Version: 6.x-1.8 » 6.x-1.x-dev
Category: Feature request » Support request
Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, as Drupal 6 is no longer supported.