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

Different header per forum?

Discussion in 'XenForo Questions and Support' started by glorify, May 15, 2011.

  1. glorify

    glorify Well-Known Member

    Anyone know how I would accomplish such a feat?
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. glorify

    glorify Well-Known Member

    I am talking swapping the header's logo.png depending on what forum you are browsing.
  4. James

    James Well-Known Member

    You could probably use the $quickNavSelected variable on the logo_block template to achieve it.
  5. A.E.

    A.E. Member

  6. Nasr

    Nasr Well-Known Member

    Perhaps in the logo template use a conditional like so

    If forum.id = 2
    then show heard2.png

    glorify likes this.
  7. glorify

    glorify Well-Known Member

    Right, that's exactly what I am looking for. Just don't know how the conditional would look or where to place lol.
  8. James

    James Well-Known Member

    Give me a few minutes and I'll see what I can do.
  9. James

    James Well-Known Member

    The easiest way of doing it would be:
    <xen:if is="{$quickNavSelected} == node-1">
    <img src="link/to/logo" alt="{$xenOptions.boardTitle}" />
    <xen:elseif is="{$quickNavSelected} == node-2">
    <img src="link/to/logo" alt="{$xenOptions.boardTitle}" />
    // etc etc etc
    You could somehow manipulate a foreach to make it easier:
    <xen:foreach loop="{$quickNavSelected}" value="{$logo}">
    <img src="link-to-logos-directory/{$logo}" alt="{$xenOptions.boardTitle}" />
    This would require all your headers to be in one directory named after each node, and for each node to require a different header.
    Oracle and glorify like this.
  10. Lawrence

    Lawrence Well-Known Member

    Do you want a different header for each forum, or for most forums? I'm asking because of sub-forms, and the header that should be displayed when a visitor is not in any forum.

    Here is the approach I would take:

    1. Style Properties: Header and Navigation -> Settings -> Header Logo Image Path:
    set to: Styles/your_nifty_style_dir_your_logos_are_located_in
    do not add the "/" at the end.

    2. Open Template -> logo_block

    Change this:
                    <img src="@headerLogoPath" alt="{$xenOptions.boardTitle}" />
    to this:

    <xen:if is="in_array({$quickNavSelected}, array(5,6,19,22,198,4567))">
    <img src="@headerLogoPath/logo{$quickNavSelected}.png" alt="{$xenOptions.boardTitle}" />
    <xen:else />
    <img src="@headerLogoPath/logo.png" alt="{$xenOptions.boardTitle}" />
    Change the numbers in the array(5,6,19,.....) to the forum_ids you want to have a different logo for.

    Make a logo for each node_id. And name each one like so: logo5.png, logo6.png, etc.

    The else statement will ensure a logo is displayed in all areas that do not have a node_id, or in forums you did not want a specific header to show.
    ragtek and glorify like this.
  11. glorify

    glorify Well-Known Member

    Thanks to you guys.

    Yes, I will probably have a different header in most forums.

    I will try both approaches and see what works for me. I will let you know. Really appreciate it :)
  12. Temery

    Temery Active Member

    Quick question: How do I find the forum id for each forum?

    EDIT: I think I have found it. In the admin node tree area I right clicked on the forum I want to ID for.

    It said:


    Can I assume the forum ID is 9?
  13. dieketzer

    dieketzer Well-Known Member

    yes, the id would be 9
  14. Rho Delta

    Rho Delta Well-Known Member

  15. Temery

    Temery Active Member

    Lawrence: Thank you for the help so far. I believe I am close, but cannot find what I am doing wrong. I want a different logo in my football forum than is in the other forums.

    Here is what I have done:

    In style properties>header and navagation I have the Header Logo Image Path set to styles/graphics

    The graphic I want to show up on the football board (ID #3) is in public_html>styles>graphics and is named syracuse_helmets.jpg

    You can view the graphic at http://syracusefan.com/styles/graphics/syracuse_helmets.jpg if you'd like

    This is what I have in the logo_block section of the Logo_Block template

    <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="in_array({$quickNavSelected}, array(3))">
    <img src="@headerLogoPath/logo{$quickNavSelected}.png" alt="{$xenOptions.boardTitle}" />
    <xen:else />
    <img src="@/syracuse_helmets.jpg" alt="{$xenOptions.boardTitle}" />
    <span class="helper"></span>

    <xen:if is="{$adData.logo}">
    <xen:include template="xenams_logo" />


    This is not working. My guess is I have something wrong in the following line:

    <img src="@/syracuse_helmets.jpg" alt="{$xenOptions.boardTitle}" />

    Any idea how I can get this working?

    Is this enough info?
  16. dieketzer

    dieketzer Well-Known Member

    ignore everything they told you. then go read this post and it will work for you.
    instead of mucking up your logo template just put your template call there. put all your helmet code into the new template, and enter the helmet.png urls in your extra.css
  17. Temery

    Temery Active Member

    Thank you! I will try this later today. One question, can this be done, but having the graphic in the below top breadcrumb template?

Share This Page