vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom Header for each Forum/Sub-Forum (https://vborg.vbsupport.ru/showthread.php?t=175966)

trigatch4 04-12-2008 06:31 PM

Custom Header for each Forum/Sub-Forum
 
Custom I want each forum to use a different header image... how would I go about doing this? The only way I can currently think of is to copy/re-install the "style" every single time with only a different header image and then choose "custom forum style" in the forum manager.

Obviously, that option ads a lot of unneccessary bulk. Is there a way to right a quick line that will check a certain folder to see if there is a header image named after the particular forum and if so, to display that, and if not, display a default?

An example of what I mean: If you had a "baseball" forum with subforums for each team, each team's sub forum could be branded for that team. Every thread, post, reply template, etc... everything you do under that forum would have the custom header for the designated forum/sub-forum.

I thought the way I suggested sounds like the easiest but I don't code so... who knows? But maybe something like this already exists? Only one I found was from 3 years ago.

Anyways, I'll let you geniuses order me around....

Discuss!

iogames 04-12-2008 09:10 PM

I've been looking for something like that too... the closest thing I had seen is this:

https://vborg.vbsupport.ru/showthread.php?t=173240

Let's wait for Lynne to pass around here ;)

Lynne 04-13-2008 02:46 AM

I think you could do something like:
HTML Code:

<if condition="$foruminfo[forumid] == x">
Insert image code for banner in forum x
<else />
<if condition="$foruminfo[forumid] == y">
Insert image code for banner in forum y
</if>
</if>

I'm pretty sure that would work. I'm not too sure about the 'if the banner exists' part of it though. I think you'd have to use a plugin to test for that. Although, if you used a plugin to test for it, then spitting it out could be pretty easy if you named them all something like headerx.jpg and headery.jpg. I think I'm gonna have to leave it up to the real coders here since I'm more of a keep-trying-until-it-works type of coder.

edit: Found the function we want - file_exists - and I'm assuming the header to use for forum 4 is header4.jpg and the header to use for forum 22 is header22.jpg, etc.
PHP Code:

 $filename '/path/to/header'.$forumid.jpg;

if (!
file_exists($filename)) {
    
$filename "default.jpg";


And then spit out the image $filename in the header template.

That's how I would go about it anyway. But, I'm sure that code has some sort of syntax error cuz they always do when I first type them out.

trigatch4 04-16-2008 04:53 PM

Lynne thank you SOOOO much for this. I haven't tried it and I'm sure it will take some tinkering but this is a solid, solid start that I can surely get to work.

You are awesome thanks so much!

iogames 04-16-2008 04:54 PM

Show me the result when you finish ;)

trigatch4 04-16-2008 06:31 PM

It might be awhile as my list of "things to do" before launch is 2352523 things long. But I'll PM you when it's done.

... BTW... how did you predict that Lynne would come around and save the day?

iogames 04-16-2008 06:56 PM

Some have 'IT', some just think they have IT ;)

trigatch4 05-30-2008 02:01 PM

Lynne... your solution works with one problem:

The headers only display if you're on that Forum/Sub-Forum's actual home screen. I want the header to display no matter where within THAT forum you are. So if you're reading a thread, reading a post, replying to post, etc... the custom banner is always there for each forum -not just on the home of that forum/subforum.

Does that make sense? I'm hoping you can be a lifesaver again!

Lynne 05-30-2008 02:52 PM

Then you may need to change it from this:
HTML Code:

<if condition="$foruminfo[forumid] == x">
To this:
HTML Code:

<if condition="$foruminfo[forumid] == x OR $thread[forumid] == x">

Lee Wallace 06-03-2008 03:48 PM

I like where you guys are going with this, thanks! One question, where does this code go? :^)


All times are GMT. The time now is 01:22 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.01049 seconds
  • Memory Usage 1,739KB
  • 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
  • (3)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete