template parameter for a CATEGORY

Weppa333

Active member
Hello

This is my first message in XF1.2 :)

I would like to find a way to create a conditional, in a template, to know whether or not I'm in a CATEGORY, and the category name/ID

I found template parmas [forum][node_id] but it seems it is NOT filled up when inside a category.

I cannot find the right template parameter for a category. can anyone help ?
 

Weppa333

Active member
I'll try, It's not really in a page per-se, it's as a conditionnal for widgetframework that I'm trying to use it.
I basically want the widget to activate only when in a specific category
 

Weppa333

Active member
I can assure you that
<xen:if is="{$category.node_id} == 1">
This content will show in category 1
</xen:if>

never show on category 1, with category as pages activated.

Same with xen:container using another variable,
 

Brogan

XenForo moderator
Staff member
I can assure you it does, I have just tested it on my local to confirm.
I edited the category view template and added that very code.

category_view.PNG

It shows in category 1 only and nowhere else.
 

Brogan

XenForo moderator
Staff member
Does your category actually have an ID of 1?

Check the URL, the ID value is at the end.
 

Weppa333

Active member
Okay I finally made it work,
$category.node_id is available only in category_view, nowhere else. This is the key to make it work.

Thanks @Brogan !
 
Top