Closed (fixed)
Project:
Google Plus One Button | Google+ Badge
Version:
7.x-1.0-rc2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2011 at 18:28 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent
Comments
Comment #1
CarbonPig commentedSubscribe - a block would be awesome for maximum flexibility!
Comment #2
CarbonPig commentedFYI - I figured out a way to add the plus one button to a block, but you don't need the google plus 1 module (Please don't think I don't love the idea of a module - Ijust needed it in a block)
You can see an example on this page about Eco Transport.
Here's how I did it:
I went into my theme and added the google recommended snippet into the page.tpl.php file like this:
at the very end of the file...
Then I created a block with the google snippet containing:
Make sure it is on full html.
and it worked - now all of my pages with that block are showing the plus 1!
You can grab the google code and customize the button here: http://www.google.com/webmasters/+1/button/
Hope this helps someone else who wants a "light" version of this module.
I know there are more standard ways of implementing java as described here: http://drupal.org/node/304255
However, that page didn't make a lot of sense to me : )
Cheers,
CarbonPig
The example: Eco Transport Article with Google + 1 button
Comment #3
corbacho commented@santam with the new version (much more complete) 7.x-1.0-rc2 I have added a block (to show a fixed URL in all the site) and also the possibility of showing the button on the Node Links section.
I didn't update the 6.x branch with the new changes, but tomorrow probably.
@CarbonPig
Yeah, it's very valid way of doing it and fits in some use cases. I plan to document it .. for developers who don't want to add the overhead of adding "1 module more"
(You don't need to wrap the script with < b > tags, though)
Notice that when you don't indicate the href attribute in the button, Google +1 script will take the current URL that you have in that moment in the browser.
But what if ...
* you have a list of node teasers in the frontpage? Each one has its own URL.
* there are pages like admin pages where you don't need the plusone.js file.. but you are adding it in *every* single page.
* You have a multi lingual site
* You want the button inside of the node .. not as separate block
That and other cases, are covered by this module.
Comment #4
santam commentedThanks for the quick update. I uninstalled and installed the new updated module. While it shows up in the links section it doesnot work. Clicking on it makes it turn red with an exclamation mark. My website is here www.isocenter.org . I will try carbonpig's method and report back if that worked.
Comment #5
santam commentedInterestingly the solution proposed by carbonpig is working. Is there anyway I can help you troubleshoot the problem I will be glad to help.
Comment #6
corbacho commentedThanks, I think now is fixed. Could you download the rc3 module to test if it works?. To make it faster, for this update you can just replace the module, no need to disable it first. There was a bug (only in rc2 module) at grabbing the node alias.
Comment #7
CarbonPig commentedHi @santam and @corbacho
Interestingly enough you can remove the javascript from the page.tpl.php file and simply put the following in a block for the same result:
However, the plus one button does not show up every time with either of the solutions I've proposed.
My guess is that some sort of pre-process needs to be done, but that is a bit beyond my ability.
When I sit and refresh my article pages, the button shows up about 40% of the time.
Any thoughts on others ways to get this going in a block on 6.x
Cheers,
CarbonPig
Comment #8
santam commentedSorry for the delay in getting back on this issue. The plus one widget is working fine now and the plus ones are getting recorded. Thank you for the great support.
Comment #9
corbacho commentedyou're welcome.
btw, Now is ready rc4 version.. was a bug of incorrect HTML in case you are using the wrapper CSS option from the admin interface.
closing..