Skip to content
WJunction - Webmaster Forum

Show thanks count for each post on threadbit & forumdisplay

Status
Not open for further replies.
Preregister a variable for use in another template

What I'm trying to do is insert {vb:raw post_thanks_count} from thanks_postbit template to threadbit template, but when I insert the code into threadbit template, it is just blank, and doesn't show the thanks count.
 
Last edited:

5 comments

I figured out what I have to do, sorta...

I have to preregister the variable for use in another template. So I tried creating a plugin/hook to threadbit_display with PHP Code..

Code:
$post_thanks_count = $templater->render();
vB_Template::preRegister('thanks_postbit',array('post_thanks_count' => $post_thanks_count));

What this is supposed to be doing is registering the {vb:raw post_thanks_count} variable from 'thanks_postbit' template so I can display it in 'threadbit_display' template. But I'm doing something wrong.
 
you can't add post_thanks_count like this.

an sql query should be enter in threadbit display to count thanks.

Example :

PHP:
$thankquery = sql query
$thank = $vbulletin->db->fetch_array($thankquery);
$thank['count'] = $thankquery;

$templater = vB_Template::create('thanks_threadbit');
$templater->register('thank', $thank);
$thanks_threadbit = $templater->render(); 
vB_Template::preRegister('threadbit',array('thanks_postbit' => $thanks_threadbit));


where thanks_threadbit is a template which u have to create in style manager.

in that add (vb raw thank.count}
 
Thanks. I am anxious to try this when I get home. I hope it works. If it does then I will gladly send you a few dollars through PayPal to show my appreciation.

So I just add the first code to a new plugin that hooks to threadbit_display and then I would create a new template called thanks_threadbit and insert (vb raw thank.count}

This will then display the amount of Thanks Received for that thread in the threadbit?
 
This is what I got..

Parse error: syntax error, unexpected T_STRING in /home/earkandy/public_html/forumdisplay.php(1050) : eval()'d code on line 4
 
Hi itsHERO,
Did you successes modified the thank count outside postbit? If already please help me. I also want to add the thank count to thanks_wrapper template to show the total thanks for every post.
Regard,
 
Status
Not open for further replies.

About the author

I
Member · Joined
5
Messages
0
Reactions
1
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom