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

XF 1.2 Template conditional for a certain forum

Discussion in 'XenForo Questions and Support' started by rellek, Aug 4, 2013.

  1. rellek

    rellek Well-Known Member

    Hi,

    I have some stuff in my header and I want to disable it in certain forums. The stuff is displayed everywhere like at the members list and in threads. How can I make the system check if I am in a node with the ID 1234 to exclude it and all of its contents from that code?

    Thanks.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    rellek likes this.
  3. rellek

    rellek Well-Known Member

    Thanks, working well!
     
  4. rellek

    rellek Well-Known Member

    It's me again.

    I have a template modification in public.css which is meant to replace that:
    Code:
    <xen:if is="!{$visitor.user_id} AND {$forum.node_id} != 47 AND {$forum.node_id} != 33">
    height: {xen:calc '@headerLogoHeight + @headerTabHeight * 2 + 317'}px;
    <xen:else />
    height: {xen:calc '@headerLogoHeight + @headerTabHeight * 2 + 2'}px;
    </xen:if>
    It's looking for that:
    Code:
    height: {xen:calc '@headerLogoHeight + @headerTabHeight * 2 + 2'}px;
    If a user is a guest and not in forum 47 or 33, it should add 317. If you are a registered user or in forum 47 or 33, it should add 2.

    Where's my mistake? It always does add 317, no matter if I'm registered or not.
     
  5. Mike

    Mike XenForo Developer Staff Member

    You can't make any CSS changes based on the visitor, the node, etc. You need to apply (or remove classes) and then target your CSS based on that.
     
  6. rellek

    rellek Well-Known Member

    Okay, thanks. So a solution would be to let TMS remove this line and put it into a normal html template based on node and user id, right?
     
  7. Mike

    Mike XenForo Developer Staff Member

    You would add a class to the HTML where you think appropriate and then add an additional CSS selector to override the rule when that class is there.
     
    rellek likes this.
  8. rellek

    rellek Well-Known Member

    Great, thanks.
     

Share This Page