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

XF 1.5 Conditional Statements with URL portions

Discussion in 'XenForo Questions and Support' started by NinaMcI, Jan 25, 2016.

  1. NinaMcI

    NinaMcI Active Member

    Hi,
    I've been trying to hide the content of an ad_ template from a page node.
    However the page node has a URL portion instead of a node ID.
    How do I write conditional statements where there is no node ID?
    Code:
    <xen:if is="!{$page.node_id} == ???">
    Thanks for your help :)
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The node ID still exists in code, it just isn't exposed to the URL.

    Which ad template are you adding that to?
    The $page param may not be available there.
    You can check using:
    Code:
    {xen:helper dump, $page}
    If that returns NULL, it's not available.
     
  3. NinaMcI

    NinaMcI Active Member

    Hi @Brogan
    I'm trying to add it to ad_above_top_breadcrumb
    Not sure how to to run the check as you suggest.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Add that code to the template and load the page.
     
  5. NinaMcI

    NinaMcI Active Member

    I've added it to template ad_above_top_breadcrumb and then saved it.
    When you say load the page, what page are you referring to?
     
  6. NinaMcI

    NinaMcI Active Member

    Ah sorry. Yes I get NULL above the content.
     
  7. NinaMcI

    NinaMcI Active Member

    Is there a way round this?
     
  8. NinaMcI

    NinaMcI Active Member

    Found it!
    I added
    Code:
    <xen:container var="$page.node_id">{$page.node_id}</xen:container>
    to the pagenode_container template.
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    NinaMcI likes this.
  10. Brogan

    Brogan XenForo Moderator Staff Member

    NinaMcI likes this.
  11. NinaMcI

    NinaMcI Active Member

    That's great @Brogan - thank you:)
     
    Brogan likes this.

Share This Page