Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Set and change Post Icon path by styleset or by forum Details »»
Set and change Post Icon path by styleset or by forum
Version: 1.00, by Michael Morris Michael Morris is offline
Developer Last Online: Jun 2009 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 10-26-2004 Last Update: Never Installs: 3
 
No support by the author.

This modification principly works through templates, but you also need to write some code into your PHPINCLUDE_START template. What it does is make the path to your post icons swapable by styleset or by forum. However many alternate post icon sets you create make SURE they all have the same # of icons with the same names or this won't work. It's also recommended you create a default icons and put it in every post icon set.

A total of 5 template modifications are required as well as changes in your post icon settings.

STEP 1: EDIT TEMPLATES.


EDITPOST

Search for:
HTML Code:
<td><img id="display_posticon" src="$selectedicon[src]" alt="$selectedicon[alt]" /></td>
Replace with
HTML Code:
<td><img id="display_posticon" src="$stylevar[post_icon_path]/$selectedicon[src]" alt="$selectedicon[alt]" /></td>

THREADBIT

Search for:
HTML Code:
<td class="alt2"><if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>
Replace with
HTML Code:
<td class="alt2"><if condition="$show['threadicon']"><img src="$stylevar[post_icon_path]/$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>

POSTICONBIT

Search for:
HTML Code:
<td width="12%"><label for="rb_iconid_$iconid"><img src="$iconpath" alt="$alttext" id="pi_$iconid" onclick="rb_iconid_$iconid.click()" /></label></td>
Replace with
HTML Code:
<td width="12%"><label for="rb_iconid_$iconid"><img src="$stylevar[post_icon_path]/$iconpath" alt="$alttext" id="pi_$iconid" onclick="rb_iconid_$iconid.click()" /></label></td>

POSTBIT and POSTBIT_LEGACY (Same code and replacement in each)

Search for:
HTML Code:
<if condition="$show['messageicon']"><img class="inlineimg" src="$post[iconpath]" alt="$post[icontitle]" border="0" /></if>
Replace with:
HTML Code:
<if condition="$show['messageicon']"><img class="inlineimg" src="$stylevar[post_icon_path]/$post[iconpath]" alt="$post[icontitle]" border="0" /></if>

STEP 2: EDIT POST ICON PATHS

1. Open your post icon editor.
2. Delete the path information for every post icon - leave only the image's name. This will break the path to the image for the editor so you want be able to review it in the admincp unless you hack the icon editor file.
3. Go to vboptions >> Thread Display Options (showthread)
4. Strip the path to the default icon, again leave only the file name.


STEP 3: CODING THE PHPINCLUDE_START TEMPLATE.

Ok, easy parts over. Now comes the fun part. You need to define $stylevar['post_icon_path']. If you went to the effort to do this you presumably want it's definition to change by styleset or by forum. The first part is to merge the new stylevar in with the other stylevars. Put the following code at the very start of your PHPINCLUDE_START template.

PHP Code:
$stylevar array_merge($stylevar,
[
'post_icon_path']
); 
Changing by styleset is easy enough - just define it in the PHPINCLUDE_START of that particular style. Here's how.

PHP Code:
$stylevar['post_icon_path'] = 'DIRECTORY CONTAINING YOUR POST ICONS FOR THIS STYLE'
It's recommended that you nest your alternate post icon sets under the /images/icons directory. For Example:

/images/icons/style1

Don't put an ending / character on the path.

Now, if you want to have forums have specific sets you'll need to do the following conditional:

PHP Code:
if ($foruminfo['forumid'] == X)
{
$stylevar['post_icon_path'] = 'DIRECTORY';
}
else
{
$stylevar['post_icon_path'] = 'DEFAULT_DIRECTORY';

X is the id# of the forum that has the special set.

If you want multiple forums to have the same set you'll either need a conditional for each one or use an in_array call.

PHP Code:
$special_forums = array('X''Y''Z');
if (
in_array($foruminfo['forumid'], $special_forums))
{
$stylevar['post_icon_path'] = 'DIRECTORY';
}
else
{
$stylevar['post_icon_path'] = 'DEFAULT_DIRECTORY';

X, Y, and Z are your forum #'s. You can have as many or as few as you like.

And that concludes the "hack." If you find it useful, please click install. I'm vain, I'll admit it.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-27-2004, 07:51 AM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or you could just use replacements to achieve this..
Reply With Quote
  #3  
Old 10-27-2004, 05:51 PM
colicab-d's Avatar
colicab-d colicab-d is offline
 
Join Date: Dec 2002
Location: Glasgow
Posts: 382
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

May I be the first to say THANK YOU!! Ive been trying to do this myself for a good while and eventually gave up due to it being a total pain in the bottom.

I can now finally start to convert Artorgs older styles back up with there original post icons

Joy!! You got yourself at least 1 big fat install
Reply With Quote
  #4  
Old 10-27-2004, 07:34 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Oblivion Knight
Or you could just use replacements to achieve this..
Not the forums part. I tried for a week to put a conditional into PHPINCLUDE_END that would execute a str_replace, but it wouldn't parse no matter what I tried. The problem is that vbulletin usets the foruminfo variable before parsing PHPINCLUDE_END, so there is NO WAY you can do a forum based post icon path.

In any event, this modification is faster and more efficient than using a replacement variable.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03860 seconds
  • Memory Usage 2,254KB
  • Queries Executed 17 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_html
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete