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

XF 1.4 Including templates, if they exist, based on variable names.

Discussion in 'Styling and Customization Questions' started by Jawsh, Dec 16, 2014.

  1. Jawsh

    Jawsh Formerly null0

    I would like to include a template before and after every node and category if they exist.

    - include category_before_{$node.id}
    - include category
    - - include node_before_{$node.id}
    - - include node
    - - include node_after_{$node.id}
    - include category_after_{$node.id}

    So, unless (for instance) catagory_after_32 exists, it does nothing.
    But if it does exist, go on to include its content.

    Is this possible? Is there a better way to do this task?
  2. j0e

    j0e New Member

    Would it be easier to create a conditional statement?
    <xen:if is="{$forum.node_id}">
              <xen:include template="template_name" />
  3. Jawsh

    Jawsh Formerly null0

    I was hoping to be able to do

    <xen:if is="{$forum.node_id}">
              <xen:include template="template_name_{$forum.node_id}" />
  4. AndyB

    AndyB Well-Known Member

  5. j0e

    j0e New Member

    Might be worth a try. Are you looking to put that in a template?

Share This Page