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

change header logo based on domain

Discussion in 'XenForo Questions and Support' started by Cory Booth, Mar 9, 2011.

  1. Cory Booth

    Cory Booth Well-Known Member

    So I have a site that could easily support two different groups of users.
    I'd like to combine these two sites into a single forum and map their current domain names to the new site.

    To this point I am good to go....

    What I would like to do now is if the user enters the site using domain name XYZ.com have the logo on all the pages = 1.png

    If the user enters the site using ZYX.com then have the logo = 2.png

    Is there a method to do this?
  2. Mike

    Mike XenForo Developer Staff Member

    There's no explicit method to do this, though in a template, you should be able to access {$_SERVER.HTTP_HOST} and do a conditional based on that.

    Note that while just changing the logo based on the domain is fine, if you hide content (to make it look like 2 individual forums), you would need 2 licenses for that.
  3. Cory Booth

    Cory Booth Well-Known Member

    Ah, didn't even think about that - but no... not changing anything else except the logo...
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is complete code if you need it:

    Admin CP -> Appearance -> Templates -> logo_block

    Replace this code:

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

    <xen:if is="{$_SERVER.HTTP_HOST} == 'www.xyz.com'">
    	<img src="path/to/1.png" alt="{$xenOptions.boardTitle}" />
    <xen:elseif is="{$_SERVER.HTTP_HOST} == 'www.zyx.com'" />
    	<img src="path/to/2.png" alt="{$xenOptions.boardTitle}" />
    Set the image paths appropriately.
    Cory Booth and Brogan like this.
  5. Cory Booth

    Cory Booth Well-Known Member

    Thank you very much...

Share This Page