• 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

rellek

Well-known member
#1
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.
 

rellek

Well-known member
#4
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.
 

Mike

XenForo developer
Staff member
#5
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.
 

rellek

Well-known member
#6
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?
 

Mike

XenForo developer
Staff member
#7
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.