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

XF 1.5 Detect if Forum/Home Page is selected?

#1
Hi guys,

I'm trying to do something only if it's forum page !! (some CSS)
i'm using this code but it's not working !!

Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
 blablabla
<xen:else />
blablabla
</xen:if>
I also tried using : " <xen:if is="{$tabs.forums.selected}"> " instead but it's not working !!

Can you please tell me how to do it ??

NB : I tried these based on the answears here : https://xenforo.com/community/threads/how-to-detect-if-the-home-page-is-selected.45208/
 

Brogan

XenForo moderator
Staff member
#2
You can't use conditional statements in CSS templates.

You would have to edit the template and add the class or CSS that way, or style the element using a specific selector.

If you can explain what you are trying to change, it may be possible using EXTRA.css.
 
#3
You can't use conditional statements in CSS templates.

You would have to edit the template and add the class or CSS that way, or style the element using a specific selector.

If you can explain what you are trying to change, it may be possible using EXTRA.css.
I even tried to do it in the template node_forum_level_2 but still it's like this conditions is wrong !
is there a way to check the page ?? for exemple if we are in the main page ?
 

Russ

Well-known member
#6
What exactly are you trying to achieve? All of the content (not the header/footer) is wrapped in a div which has a unique class. The forum_list for instance:

Code:
<div id="content" class="forum_list">
So you can use CSS to target things specific to that page, .forum_list .sidebar h3 { blah blah}
 

Daniel Hood

Well-known member
#7
You can see if template variables are included (and what the value is) in a template by doing {xen:helper dump, $var}. Though, there may be a better solution like @Russ said if you tell us what you're shooting for.
 
#8
What exactly are you trying to achieve? All of the content (not the header/footer) is wrapped in a div which has a unique class. The forum_list for instance:

Code:
<div id="content" class="forum_list">
So you can use CSS to target things specific to that page, .forum_list .sidebar h3 { blah blah}
Thanks Bro ;) works as charm !