Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
Dynamic Favicon Details »»
Dynamic Favicon
Version: 1.00, by rukia rukia is offline
Developer Last Online: Oct 2008 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.7.x Rating:
Released: 09-16-2008 Last Update: Never Installs: 0
 
No support by the author.

Edit: Browser error, delete this please.

>> Note: This requires Apache & mod rewrite. If you do not have these, I cannot help you. <<

What does it do?
This little code snippet and directory setup, combined with mod rewrite will allow you to dynamically generate a favicon for your site based on the user's style preference.

What is required for this to run properly?
Apache & mod rewrite. If you do not have these, the mod will not function properly.

Absolutely no change or addition in vBulletin code is necessary.

For those of you who want to skip code addition and upload the files, I've attached the PHP code to the post, however you will need to be sure you rename htaccess.txt to .htaccess once you've uploaded it. If you have an existing .htaccess file, please do not overwrite it, instead follow the instructions I've provided here.

First, create a new file in the root directory of your forum called favicon.php
If you do not know where this is, navigate to vBulletin Options -> Site Name / URL / Contact Details and look at the URL provided for Forum URL. This is the root directory of your forum.

In this new file, you will need to add the following code.

>> NOTE: YOU WILL NEED TO CHANGE THE FILE PATHS FOR THIS TO FUNCTION PROPERLY. <<
To do this, locate /skins/default/misc/favicon.ico
You will need to change this to the misc images directory path of your DEFAULT FORUM SKIN. For example, if the directory path is /images/default/misc/ then you will need to change it to /images/default/misc/favicon.ico

PHP Code:
<?php
require_once('global.php');
$favicon = (file_exists(".{$stylevar['imgdir_misc']}/favicon.ico") ? $vbulletin->options['bburl'].$stylevar['imgdir_misc'].'/favicon.ico' $vbulletin->options['bburl'].'/skins/default/misc/favicon.ico');
$ico = @file_get_contents($favicon);
header("Content-Type: image/x-icon");
echo 
$ico;
?>
Now, save favicon.php and create a new file in the same directory as this one. We will call this file .htaccess
If you already have a .htaccess file, you will need to make a few additions to it to make sure the PHP code we just added is properly used.

At the top of your .htaccess file, add the following lines.

Code:
RewriteEngine on
RewriteRule favicon.ico favicon.php
If you already have mod rewrite enabled, RewriteEngine on can be omitted from this entry.

Now that we've set up the code and instructed Apache to look at favicon.php for our favicon, we need to set up the directory structure. Note that if you do not have a favicon in all directories, the code will automatically use the favicon from your default skin.

>> Note: You will need to leave favicon.ico in your root directory along with favicon.php. It does not matter what this icon looks like, it merely matters that it exists in the directory for purposes of mod rewrite. <<

Simply locate your /skins/style/misc/ directories, and add your own custom favicon for each one until you are satisfied with them.

Note that the change may not be immediate, depending on your browser. You may have to clear history and/or cache for it to update, and in some cases, it may not update at all, or for awhile even.

Show Your Support

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

Comments
  #2  
Old 09-17-2008, 12:33 AM
dtv100 dtv100 is offline
 
Join Date: Apr 2007
Location: in the south of the north
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok so if I have 2 skin one is in root/red123 and the other one is in root/images/style/red321

how the links should be then in both step?

thanks for share .
Reply With Quote
Reply

Thread Tools

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 06:50 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06966 seconds
  • Memory Usage 2,207KB
  • 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
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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