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

XF 1.2 Conditional to check if forum is sub forum of another forum?

Discussion in 'XenForo Questions and Support' started by Razasharp, Dec 15, 2013.

  1. Razasharp

    Razasharp Well-Known Member

    Is there a conditional to check that a forum is a sub forum of another forum?

    If not is there a conditional I can use to check that the forum is in an array of forum IDs? First one would be ideal as it means I won't have to manually update the conditional each time a new sub forum is added.

    Thanks in advance.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Razasharp likes this.
  3. Razasharp

    Razasharp Well-Known Member

  4. Razasharp

    Razasharp Well-Known Member

    Is there an array version of that btw @Brogan?

    (To check if the parent node is any of the ids in an array)
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Try this: <xen:if is="in_array({$forum.parent_node_id}, array(x, y, z))">
     
    Razasharp likes this.
  6. Razasharp

    Razasharp Well-Known Member

    Awesome - thanks! :)
     
  7. russoroni

    russoroni Active Member

    I'm trying to use a conditional in one of the ad_ templates which I've been doing without issue until I tried to apply one to a forum ID with double digits.

    If I do this it works fine: <xen:if is="{$forum.node_id} % {$xenOptions.messagesPerPage} == 6 AND !{$message.conversation_id}">

    but this isnt working:

    <xen:if is="{$forum.node_id} % {$xenOptions.messagesPerPage} == 86 AND !{$message.conversation_id}">
     
  8. russoroni

    russoroni Active Member

    Nevermind. Got it. Used <xen:if is="in_array({$forum.node_id}, array(86))"> all is well.
     

Share This Page