PDA

View Full Version : Header(s) based on forum categories


Inferno Dragon
02-20-2006, 02:22 PM
Hi,
I would like to have different header templates within a style based on the forum categories! for example Xbox category and child-forums have different header template, PS2, PC etc and their child-forums can have their own different header template..

can we can do such sort of thing? :o

Reeve of shinra
02-20-2006, 03:35 PM
You could replace this in your header template


<img src="$stylevar[titleimage]


with this


<img src="./board/images/logo/logo-$forum[forumid].jpg" />


Then you would have a folder called /logo/ with
logo-1.jpg (for forum id 1)
logo-2.jpg (for forum id 2)
etc

I'm just wondering if there would be an easy way of adding a template conditional to show the default header if a customized one wasn't available but I think that would require adding a field to the db and marking it off to determine if one is available or not.

Inferno Dragon
02-20-2006, 06:07 PM
Thanks "Reeve of shinra"! actually I had this in my mind already but as I said I want kind of modification which also change the header of the child-forums as well without creating lots of images..for example:

I want the Xbox header for:

- Xbox Section
- sub forum 1
- sub forum 2

- PS2
- sub forum 1
- sub forum 2

see..I if a user is browsing Xbox then I want that he/she will see xbox header in xbox forum as well as in its child forum etc...same goes with PS2 and other forums :)

Thanks,

Reeve of shinra
02-20-2006, 06:12 PM
Oh, ... we'll something like this might work. You may need to tweak the sytnax a bit.


<if condition="$forum[forumid] = 1 OR $forum[forumid] = 3 OR $forum[forumid] = 5">
<img src="./board/images/logo/logo-xbox.jpg" />
<else />

<if condition="$forum[forumid] = 2 OR $forum[forumid] = 4 OR $forum[forumid] = 6">
<img src="./board/images/logo/logo-playstation.jpg" />
<else />

<img src="$stylevar[titleimage]" />
</if>
</if>
</if>

Inferno Dragon
02-21-2006, 03:48 PM
Now that's much better..I will give it a try and thanks a lot for your idea/help! :)

Lost_Prophet
03-25-2006, 09:36 PM
Hi,
I've been looking for something to do this, and tried out the suggestion in this post. However it's not working for me.

The path to the images is correct, I've verified this by taking out the call to $forum[forumid] and putting in a number.
Unfortunately switching back to the $forum[forumid] just yields a no-show.

The code I'm using is below.

<a href="index.php"><img src="http://www.hybrid-gamers.com/forums/images/headers/mxo/header-$forum[forumid].jpg" alt="" width="100%" height="150" border="0" /></a>

Borgs8472
03-25-2006, 09:41 PM
^ ^
try using relative paths like in the example, e.g.
/images/headers/mxo/header-$forum[forumid].jpg" alt="" width="100%" height="150" border="0" /></a>

Lost_Prophet
03-25-2006, 11:45 PM
Still no luck I'm afraid :(

A sunday /bump
I'm tempted to try out the
<if condition="$forum[forumid] = 1 OR $forum[forumid] = 3 OR $forum[forumid] = 5">
<img src="./board/images/logo/logo-xbox.jpg" />
<else />
stuff, but I'm looking to apply a different header for about 26 forums, so doing that would end up with a LOT of code!

Lost_Prophet
03-27-2006, 05:51 PM
Well I tried to use the if else version, but it still won't work.
Beware, it's long!
<if condition="$forum[forumid] = 7 OR $forum[forumid] = 43 OR $forum[forumid] = 44 OR $forum[forumid] = 26 OR $forum[forumid] = 31">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-7.jpg" />
<else />

<if condition="$forum[forumid] = 27">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-27.jpg" />
<else />

<if condition="$forum[forumid] = 29">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-29.jpg" />
<else />

<if condition="$forum[forumid] = 147">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header147.jpg" />
<else />

<if condition="$forum[forumid] = 32">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-32.jpg" />
<else />

<if condition="$forum[forumid] = 33">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-33.jpg" />
<else />

<if condition="$forum[forumid] = 45">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-45.jpg" />
<else />

<if condition="$forum[forumid] = 66">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-66.jpg" />
<else />

<if condition="$forum[forumid] = 68">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-68.jpg" />
<else />

<if condition="$forum[forumid] = 67">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-67.jpg" />
<else />

<if condition="$forum[forumid] = 34">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-34.jpg" />
<else />

<if condition="$forum[forumid] = 35">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-35.jpg" />
<else />

<if condition="$forum[forumid] = 36">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-36.jpg" />
<else />

<if condition="$forum[forumid] = 190">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-190.jpg" />
<else />

<if condition="$forum[forumid] = 191">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-191.jpg" />
<else />

<if condition="$forum[forumid] = 37">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-37.jpg" />
<else />

<if condition="$forum[forumid] = 61">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-61.jpg" />
<else />

<if condition="$forum[forumid] = 130">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-130.jpg" />
<else />

<if condition="$forum[forumid] = 131">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-131.jpg" />
<else />

<if condition="$forum[forumid] = 132">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-132.jpg" />
<else />

<if condition="$forum[forumid] = 133">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-133.jpg" />
<else />

<img src="$stylevar[titleimage]" />
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>

Here is my header sans that information. Can anyone see a reason why it wouldn't be working?

<!-- logo -->
<a name="top" id="top"></a>
<table width="800" border="1" cellspacing="0" cellpadding="0" align="center" class="page">
<tr>
<td>
<table width="800" border="0" cellspacing="0" cellpadding="0" align="center" class="page">
<tr>
<td>
<a href="index.php"><img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-7.jpg" alt="" width="100%" height="150" border="0" /></a></td>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="vbmenu_control">&nbsp;</td>
</tr>
</table></td>

</tr>
<tr>
<td></td>
</tr>
</table>
<!-- /logo -->

<!-- content table -->
<div align="center">
<div style="width:90%; text-align:left;">
$_phpinclude_output

Nutz
03-27-2006, 06:18 PM
<if condition="$forum[forumid] = 7 OR $forum[forumid] = 43 OR $forum[forumid] = 44 OR $forum[forumid] = 26 OR $forum[forumid] = 31">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-7.jpg" />
<else />

<if condition="$forum[forumid] = 27">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-27.jpg" />
<else />

<if condition="$forum[forumid] = 29">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-29.jpg" />
<else />

<if condition="$forum[forumid] = 147">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header147.jpg" />
<else />

<if condition="$forum[forumid] = 32">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-32.jpg" />
<else />

<if condition="$forum[forumid] = 33">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-33.jpg" />
<else />

<if condition="$forum[forumid] = 45">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-45.jpg" />
<else />

<if condition="$forum[forumid] = 66">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-66.jpg" />
<else />

<if condition="$forum[forumid] = 68">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-68.jpg" />
<else />

<if condition="$forum[forumid] = 67">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-67.jpg" />
<else />

<if condition="$forum[forumid] = 34">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-34.jpg" />
<else />

<if condition="$forum[forumid] = 35">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-35.jpg" />
<else />

<if condition="$forum[forumid] = 36">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-36.jpg" />
<else />

<if condition="$forum[forumid] = 190">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-190.jpg" />
<else />

<if condition="$forum[forumid] = 191">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-191.jpg" />
<else />

<if condition="$forum[forumid] = 37">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-37.jpg" />
<else />

<if condition="$forum[forumid] = 61">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-61.jpg" />
<else />

<if condition="$forum[forumid] = 130">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-130.jpg" />
<else />

<if condition="$forum[forumid] = 131">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-131.jpg" />
<else />

<if condition="$forum[forumid] = 132">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-132.jpg" />
<else />

<if condition="$forum[forumid] = 133">
<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-133.jpg" />
<else />

<img src="$stylevar[titleimage]" />
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>
</if>

You can replace all that with this:


<img src="http://hybrid-gamers.com/forums/images/headers/mxo/header-$forum[forumid].jpg" />


As for the reset of your code, sorry but it was far to messed up for me to read/fix at the moment.

Thanks,
Mat

Lost_Prophet
03-27-2006, 06:30 PM
Hi - I realise that, I've tried it already and it doesn't work.
I replaced it with that mess of ifs and elses to see if I could at least get the images to appear the long way around, but it's a no go.

I'm not au fait enough with vBulletin to know whether this is on-target or not, but it seems like the header template has no way of telling what $forum[forumid] is even supposed to be and where it comes from ...

Nutz
03-27-2006, 07:32 PM
Oh I didn't know you were trying to put this in the header template. No I don't think you can do that without some kind of hack.

Thanks,
Mat

Lost_Prophet
03-27-2006, 09:15 PM
Damn :(
Based on Reeve of Shinra's posts above I thought that's what he was aiming at.

No per-forum headers for me yet then I guess!

Lost_Prophet
03-29-2006, 01:29 PM
Thanks to a helpful soul on the vBulletin.com forums - to achieve this you should use $foruminfo[forumid] instead of $forum[forumid]

:)