Tips & Tricks Using Template Variables:
While the Helpful Answers section may appear to only add to a small part of your post it can be used much more extensively to change the color of an entire post, to add a special icon or just about anything else you like. Here are list of the variables available for your
postbit and postbit_legacy templates.
Code:
$post[totalrank] - The total number of ratings
$post[goodrank] - The number of good ratings
$post[badrank] - The number of bad ratings
$post[helpfulgood] - True if the post is positive overall (more good than bad ratings)
$show[rate_helpfulanswer] - True if the user can rate the post (false if they are banned or have rated it).
$post[helpfulanswerid] - True if the user has already rated the post.
$post[hagoodrank] - The number of good votes the user's posts have
$post[hatotalrank] - The total rank the user's posts have
$post[habadrank] - The number of bad votes the user's posts have
================================================== ==========================
Additional variables can also be found in the user's profile page (if enabled).
Code:
$helpfulposts[totalranks] - The total ratings of a member's ppsts
$helpfulposts[goodranks] - The total good ratings of a member's posts
$helpfulposts[badranks] - The total bad ratings of a member's posts
================================================== ==========================
Identify the top rated post.
Step 1 - Enable the top rated post feature from your Helpful Answers Settings.
Step 2 - Add the code:
Code:
<if condition="$thread[toppost] == $post[postid] AND THIS_SCRIPT == 'showthread'">This is the top rated post!</code>
To your postbit or postbig_legacy template
This can be changed around to add colors, an icon or anything else you want.
================================================== ==========================
Digg Like Ratings (Format: +6 Yes | No)
Step 1 - Open the template
helpful_answers
Step 2 -
Replace the code
Code:
<if condition="$post['totalrank']">
<phrase 1="$post[goodrank]" 2="$post[totalrank]">$vbphrase[helpfulanswer_x_out_of_y]</phrase>
</if>
With the new code:
Code:
<if condition="$post['totalrank']">
+ $post[goodrank]
</if>
================================================== ==========================
(Thumb Up)...5 (Thumb Down)...2
Step 1 - Open the template
helpful_answers
Step 2 -
Replace the code
Code:
<if condition="$post['totalrank']">
<phrase 1="$post[goodrank]" 2="$post[totalrank]">$vbphrase[helpfulanswer_x_out_of_y]</phrase>
</if>
With the new code:
Code:
<if condition="$post['totalrank']">
<img src="images/buttons/ha_thumbsup.gif" width="11" height="20" border="0" alt="Good" /> $post[goodrank]
<img src="images/buttons/ha_thumbsdn.gif" width="11" height="20" border="0" alt="Bad" /> $post[badrank]
</if>
================================================== ==========================
Highlighting the top rated post:
Step 1 - Set "
Get Top Post per Thread" to on in your Helpful Answers settings.
Step 2 - Open your
postbit or
postbit_legacy template (whichever your forum uses)
Step 3 - Find all instances of class="alt1" and class="alt2"
Step 4 - At each instance add the following code directly after style="
Code:
<if condition="$thread[toppost] == $post[postid]">background-color:#CCCCCC;</if>
#CCCCCC is the color to highlight the post with. You may change this to another HTML Color Code
Step 5 - Repeat this for each instance (there may be as many as 5 depending on the template)
For example:
Code:
<td class="alt1" align="$stylevar[right]" style="<if condition="$thread[toppost] == $post[postid]">background-color:#CCCCCC;</if>border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-$stylevar[left]: 0px; border-top: 0px">
================================================== ==========================
Utility Scripts
Three utility scripts are attached to this post which you may need to use if you are modifying the addon or doing a special import. Each of these should be run from your admincp folder and deleted after use.
1. ha_userstats.php - This file will resync user votes for the postbit templates.
2 . ha_old.php - This file will resync vote summaries for version 1.5 and below.
3. ha_revote.php - This file will resync vote summaries for versions 1.6 and above