Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-09-14 06:05:14

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,171
Website GitHub Mastodon Twitter

how do I detect I am on a child category...?

How can I detect if I am on a category page which has a particular parent category?

this is what I am trying to achieve: <txp:if_category parent="some_parent_cat">show something<txp:else />show something else</txp:if_category>

I know that the parent attribute is not supported in the if_category tag but included it above as it clearly explains where I am lost. I am looking at smd_parent but I am wondering if it can be done using native tags.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2012-09-14 07:48:30

etc
Developer
Registered: 2010-11-11
Posts: 5,388
Website GitHub

Re: how do I detect I am on a child category...?

Hi colak! Something like this?

<txp:category_list parent="some_parent_cat">
  <txp:if_category name='<txp:category />'>
    <txp:variable name="done" value="1" />
  </txp:if_category>
</txp:category_list>

<txp:if_variable name="done" value="1">
  show something
<txp:else />
  show something else
</txp:if_variable>

Offline

#3 2012-09-14 08:03:30

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,171
Website GitHub Mastodon Twitter

Re: how do I detect I am on a child category...?

Hey Oleg

This looks like it might work. Thanks!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB