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

XF 1.1 Category under a Parent category, xen:if is not working

Discussion in 'XenForo Questions and Support' started by RoldanLT, Jul 21, 2013.

  1. RoldanLT

    RoldanLT Well-Known Member

    My Forum structure:

    Main category1
    Forum2
    Forum3
    Category4
    Forum5​

    I have this code to hide on a certain category.
    PHP:
    <xen:if is="{$category.node_id} != 4">
    This content will not show in category 4
    </xen:if>
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    From the FAQ:

    Note that in order for this to work, you must have categories set as pages in the ACP -> Options -> Node & Forum List: Create Pages for Categories.
     
  3. RoldanLT

    RoldanLT Well-Known Member

    Yes, It's a Page category.
     
  4. RoldanLT

    RoldanLT Well-Known Member

    And I'm using the condition inside ad_ templates,
    ad_below_content / top both not working.
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Can you post a link to the category?
     
  6. RoldanLT

    RoldanLT Well-Known Member

    It's hidden section.
    I can PM you.
     
  7. RoldanLT

    RoldanLT Well-Known Member

    PM'ed.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Just checked the source code and the node id is 159.
     
  9. RoldanLT

    RoldanLT Well-Known Member

    It's not a category?
    it's a node?
    My 1st post is just an example.
     
  10. Jeremy

    Jeremy XenForo Moderator Staff Member

    Categories are a type of node in XenForo, just like pages, link forums, and forums.
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Just to follow up on this, the category node ID isn't available in the ad templates.

    To make it available you have to add this to the category_view template:
    Code:
    <xen:container var="$category.node_id">{$category.node_id}</xen:container>
    Big thanks to @Chris Deeming for the solution.
    Wish I'd asked him sooner instead of wasting time trying to get my incorrect xen:container code working :D
     
    RoldanLT likes this.
  12. RoldanLT

    RoldanLT Well-Known Member

Share This Page