vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Set and change Post Icon path by styleset or by forum (https://vborg.vbsupport.ru/showthread.php?t=71045)

Michael Morris 10-26-2004 10:00 PM

Set and change Post Icon path by styleset or by forum
 
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.

Oblivion Knight 10-27-2004 07:51 AM

Or you could just use replacements to achieve this.. ;)

colicab-d 10-27-2004 05:51 PM

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!! :D:D:D:D You got yourself at least 1 big fat install :)

Michael Morris 10-27-2004 07:34 PM

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.


All times are GMT. The time now is 12:36 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.01118 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete