View Single Post
  #2  
Old 02-03-2009, 09:22 PM
Ted S Ted S is offline
 
Join Date: Dec 2003
Location: SoCal
Posts: 3,954
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Attached Files
File Type: php ha_old.php (2.7 KB, 73 views)
File Type: php ha_revote.php (2.8 KB, 71 views)
File Type: php ha_userstats.php (2.8 KB, 64 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01455 seconds
  • Memory Usage 1,818KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (3)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete