Banner For Each Forum

fords8

Member
I would like to add a different banner for each forum.

So if I have a category for games and have forums under it for COD, BF3, FEAR, and so on. When a user clicks on the COD forum, at the top of it I want to have a banner for COD. Same for BF3 and so on.

Thanks for any help!

EDIT: I should of also said that I wanted the banner to be in the center.
 

Jake Bunce

XenForo moderator
Staff member
Edit this template to replace the title image for specific forums:

Admin CP -> Appearance -> Templates -> logo_block

Add the red code:

Rich (BB code):
<div id="logoBlock">
	<div class="pageWidth">
		<div class="pageContent">
			<xen:include template="ad_header" />
			<xen:hook name="header_logo">
			<div id="logo"><a href="{$logoLink}">
				<span><xen:comment>This span fixes IE vertical positioning</xen:comment></span>
				<xen:if is="{$forum.node_id} == 2">
					<img src="path/to/image.gif" alt="{$xenOptions.boardTitle}" />
				<xen:elseif is="{$forum.node_id} == 8" />
					<img src="path/to/image.gif" alt="{$xenOptions.boardTitle}" />
				<xen:else />
					<img src="@headerLogoPath" alt="{$xenOptions.boardTitle}" />
				</xen:if>
			</a></div>
			</xen:hook>
			<span class="helper"></span>
		</div>
	</div>
</div>
Add more xen:elseif's to the middle to check more node_ids.
 
Reactions: Kim

fords8

Member
Thanks for the help Jake. But I would like the banner under the home, forums, and in my case games. Have a look at the pic please.
bannerplace.jpg
 

Jake Bunce

XenForo moderator
Staff member
In that case use this template:

Admin CP -> Appearance -> Templates -> ad_below_top_breadcrumb

Rich (BB code):
<div style="text-align: center;">
	<xen:if is="{$forum.node_id} == 2">
		<img src="path/to/image.gif" />
	<xen:elseif is="{$forum.node_id} == 8" />
		<img src="path/to/image.gif" />
	</xen:if>
</div>
 

fords8

Member
Hey Jake thanks. That will work out great. Thanks for your time. Would be great if a mod was made for this. Maybe when you make a new forum, add a spot to put your banner link into.
 

strongarm_playa

Active member
In that case use this template:

Admin CP -> Appearance -> Templates -> ad_below_top_breadcrumb

Rich (BB code):
<div style="text-align: center;">
 <xen:if is="{$forum.node_id} == 2">
 <img src="path/to/image.gif" />
 <xen:elseif is="{$forum.node_id} == 8" />
 <img src="path/to/image.gif" />
 </xen:if>
</div>
I inserted this code to add a banner to my forums, but where do I go to insert the image or link to display the image for that matter?
 

craigiri

Well-known member
The banner would go on the line where it says
Code:
"path/to/image.gif"
You could also use a full link and graphic there....

fords - there are a number of ways you can show different banners in each forum based on the node ID. I use an external program to serve those....

As an example, you can build a unique URL using the forum node id - using Javascript. I use a hacked together piece which calls banners from an external program..this allows me to rotate banners, control displays, etc.

Here is the Javascript I use which will build and call a URL (a perl script in my case) which is unique to the forum and to the ad placement location:

Code:
<xen:hook name="ad_thread_view_below_messages" />
 
<xen:if is="{$forum.node_id} > 0">
 
<div style="text-align: center;">
 
<script type="text/javascript">
 
function staticLoadScript(url)
{
  document.write('<script src="', url, '" type="text/JavaScript"><\/script>');
}
 
staticLoadScript("http://hearth.com/cgi-bin/forumbottom" + {$forum.node_id} + '.' + "pl?jscript");
 
</script>
 
</div>
</xen:if>
 

strongarm_playa

Active member
Ok, So I am confused...

Rich (BB code):
<div style="text-align: center;">
 <xen:if is="{$forum.node_id} == 2">
 <img src="path/to/image.gif" />
 <xen:elseif is="{$forum.node_id} == 8" />
 <img src="path/to/image.gif" />
 </xen:if>
</div>
I completely understand where the link goes for the image I will be using (Note: the quoted image)
And above it is referenced to place the code in the following:

Admin CP -> Appearance -> Templates -> ad_below_top_breadcrumb

But I want each individual forum category to have its own image. For example, if I select the Call Of Duty category it will open up another forum. There I want to add a banner for COD. Then I want to do the same for Madden, then NBA2k and so on and so on. Does this make sense?
 

craigiri

Well-known member
Hmm...let me try to give some help with the framework here....

1. You need to upload the banners yourself to somewhere - example
http://www.mysite.com/banners/

2. So, let's pretend you had three forums - each has a node_id - 1,2,3
1 is madden, 2 is COD, 3 is NBA

3. So you create three banners and put them in the banner directory....you name them
madden.jpg, cod.jpg and nba.jpg

4. The code to display the above in the forums would be
Code:
<div style="text-align: center;">
<xen:if is="{$forum.node_id} == 1">
<img src="banners/madden.jpg" />
<xen:if is="{$forum.node_id} == 2">
<img src="banners/cod.jpg" />
<xen:elseif is="{$forum.node_id} == 3" />
<img src="banners/nba.jpg" />
</xen:if>
</div>
Or something like that! I don't do a lot of ifs, so not sure if that's the way to nest them.......but basically each line can be translated as

"If we are in forum named (this), then pull this banner....."

Does that sound right?
 

strongarm_playa

Active member
WOW! I cant believe I just read that. SMH! I apologize.. I know exactly what I was doing wrong. HAHA. Let me give it a shot tho. Hopefully it will work this time. Damn me man.. smh
 

strongarm_playa

Active member
Im good now! Thank you for talking to me like a child. LOL.. Sorry I been in class all day and my mind has 500 things running through it..
 

craigiri

Well-known member
I wasn't talking that way...just that I wrote manuals for products in the past....
:)

At the same time I was writing this to you, another member here wrote one like it to me...explaining a similar thing!

Glad it's starting to work....as I said, not sure if you use the two esleifs...might be all if's until the last one...
 

strongarm_playa

Active member
In that case use this template:

Admin CP -> Appearance -> Templates -> ad_below_top_breadcrumb

Rich (BB code):
<div style="text-align: center;">
 <xen:if is="{$forum.node_id} == 2">
 <img src="path/to/image.gif" />
 <xen:elseif is="{$forum.node_id} == 8" />
 <img src="path/to/image.gif" />
 </xen:if>
</div>
Can you not use this code for a category? I even changed the word Forum to Category and still.. no luck
 

Craig

Active member
Edit this template to replace the title image for specific forums:

Admin CP -> Appearance -> Templates -> logo_block

Add the red code:

Rich (BB code):
<div id="logoBlock">
<div class="pageWidth">
<div class="pageContent">
<xen:include template="ad_header" />
<xen:hook name="header_logo">
<div id="logo"><a href="{$logoLink}">
<span><xen:comment>This span fixes IE vertical positioning</xen:comment></span>
<xen:if is="{$forum.node_id} == 2">
 <img src="path/to/image.gif" alt="{$xenOptions.boardTitle}" />
 <xen:elseif is="{$forum.node_id} == 8" />
 <img src="path/to/image.gif" alt="{$xenOptions.boardTitle}" />
 <xen:else />
<img src="@headerLogoPath" alt="{$xenOptions.boardTitle}" />
</xen:if>
</a></div>
</xen:hook>
<span class="helper"></span>
</div>
</div>
</div>
Add more xen:elseif's to the middle to check more node_ids.
Will this code allow me to place a banner or the like in the forums in a similar fashion to this site;

http://www.mazdaspeedforums.org/forum/

In the Mazda Speed Forum Sponsors.

I would also like the banner to link back to the sponsors' own site.

Thanks in advance
 

Craig

Active member
You can use HTML in the forum descriptions to add images to that area:

Admin CP -> Applications -> Display Node Tree
I get the picture to show up if you "hover" over it, but not as a constant image
below the Title of the node on the home page
 
Top