1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Banner For Each Forum

Discussion in 'Styling and Customization Questions' started by fords8, Jan 18, 2012.

  1. fords8

    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.
     
  2. Jake Bunce

    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:

    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.
     
    Kim likes this.
  3. fords8

    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
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In that case use this template:

    Admin CP -> Appearance -> Templates -> ad_below_top_breadcrumb

    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>
    
     
    gordy likes this.
  5. fords8

    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.
     
  6. strongarm_playa

    strongarm_playa Active Member

    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?
     
  7. craigiri

    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>
     
    Jake Bunce and Taxi like this.
  8. strongarm_playa

    strongarm_playa Active Member

    Ok, So I am confused...

    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?
     
  9. craigiri

    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 likes this.
  10. strongarm_playa

    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
     
  11. strongarm_playa

    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..
     
  12. craigiri

    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...
     
    Digital Doctor likes this.
  13. strongarm_playa

    strongarm_playa Active Member

    how do you do the same thing for categories??

    tried same code, but doesnt work..

    only on forums
     
  14. strongarm_playa

    strongarm_playa Active Member

    Can you not use this code for a category? I even changed the word Forum to Category and still.. no luck
     
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  16. Digital Doctor

    Digital Doctor Well-Known Member

    Edited for reasonableness.
    Thanks craigiri. Don't let him strongarm you.
     
  17. strongarm_playa

    strongarm_playa Active Member

    hey..hey.. I was just trying to be funny. No pun intended.. My bad bro :ROFLMAO:
     
    Digital Doctor likes this.
  18. Craig

    Craig Active Member

    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
     
  19. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

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

    Admin CP -> Applications -> Display Node Tree
     
    Craig likes this.
  20. Craig

    Craig Active Member

    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
     

Share This Page