I have a special template file for a specific content type.
In this template file I use some hidden CCK fields passed to other scripts that are external to Drupal and do some other formatting stuff with this node type.
I like the Plus1 module and would like to move its' placement to somewhere more convenient for my layout. I don't have a need for the overhead of Views at this time and would just like to modify my template to include the Plus1 module at a specific place.
Is there a way to do this?
Also... Is it possible that in the future development of the Plus1 module that it could use a "mini-template" so that the core does not have to be edited to make it fit EXACTLY the way that a person would like.
For instance I want to give the Plus1 module a name header and a little "?" image that has a little bit of "What is this information" but I have to modify the core to do this.
Thanks for any help!
Comments
Comment #1
tuti commentedthis will print the voting widget(you may need to node_load() the node you want to vote on before..):
print plus1_jquery_widget($node,0,0); ;Comment #2
Cactii1 commentedThat works great! Thank you.
What are the two zeros on the end for???
There's not much documentation for this module... :(
Comment #3
bjacob commentedThe function plus1_jquery_widget() has three parameter: node, teaser and page. These params are also available within the theme function of this module. For me it seems that these params are not used right now. Check the settings page of the module. If you want to create your own theme function you can create different output for teaser and full page view.
Comment #4
Chill35 commentedIn your special node template, print the following variable where you need your widget to be located:
It will be themed correctly.
Comment #5
Chill35 commentedThe module already registers a theming function for the widget. All you need to do is to create a file with name
plus1-widget.tpl.phpin your theme folder.Available variables in your template are:
$node Node object
$score Integer
$logged_in TRUE or FALSE
$is_author TRUE or FALSE
$voted TRUE or FALSE
$teaser TRUE or FALSE
$page TRUE or FALSE
Comment #6
Cactii1 commentedComment #7
GMercey commentedCan you post the code?
because it doesn't work with me :(
Comment #8
asak commentedsubscribing, and wondering how this fits with #375769: Embed Plus1 button as field in a view
Comment #9
nicolamj commentedI'm reviving this old issue largely because it's the only (semi) useful thing that comes up if you're searching for plus1-widget.tpl.php.
The problem I'm struggling with is... what to put in plus1-widget.tpl.php? It's not like the plus1 module has a tpl file you can copy. I copied the code from theme_plus1_widget(), which seems to work okay, except the $node->nid part just prints an empty string, so the widget prints, but it's not functional - can't get # of votes, can't vote.
The url is supposed to be /plus1/vote/[nid here]?token=blah, but instead I see:
Vote
ideas? I know a little bit about theming, but clearly not enough to get this working...
Thanks!