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

Is there a IF function available for hooks?

Discussion in 'Styling and Customization Questions' started by NDM, Jan 30, 2013.

  1. NDM

    NDM Member

    Hi there,

    I am trying to include a template based on a specific condition. What I basically want to do is checking if the page I am accessing is a custom XF page and if so, then include a template.

    In the pagenode_container template is a line which shows the pagenode_container_article content, so this would be a good start to add something. But the problem is that what I want to include is similar to a sidebar, I need to add the code at the very top. So what I need to check is something like IF this is an article, THEN include my template.

    This code is what exists in the template

    What I am looking for is something like:

    Any idea how I could get this done? I think if I just did

    then it would probably include my template in forum pages too, which is what I do not want. I really just want to include it if the page I am accessing is actually a PAGE.

  2. Chris D

    Chris D XenForo Developer Staff Member

    pagenode_container is only used in pages, e.g. http://xenforo.com/community/pages/example-page/

    I think you might be getting confused with PAGE_CONTAINER

    So your example code would work and only display on pages. It would not display on forums etc.

    Also, technically, it's nothing to do with hooks if you're just going to directly edit the template.

Share This Page