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

Template including

Discussion in 'XenForo Development Discussions' started by Mythotical, Oct 6, 2010.

  1. Mythotical

    Mythotical Well-Known Member

    I know that:
    HTML:
    <xen:include template="{$block.block_template}" />
    Won't work, so I remove { } but I get no return for the variable. There a specific way to make this work by using a variable from the database that has a template name?
     
  2. CurveGotti

    CurveGotti Active Member

    I think the correct method would be
    HTML:
    <xen:include template="block.block_template" />
    
    no { } or $

    hopefully :)
     
  3. Mythotical

    Mythotical Well-Known Member

    That is correct if I was pulling a template like that but the var is replaced by a pre-determined entry in the database from a separate table.
     
  4. CurveGotti

    CurveGotti Active Member

    ok I see what you mean now, no idea on that one then. I'll have to look around and see if I can find an instance anywhere, or hopefully someone else has a valid answer before we go mad looking for such an example :confused:
     
  5. Mythotical

    Mythotical Well-Known Member

    LOL no kidding, I have been driving myself bonkers trying to figure this out.
     
  6. CurveGotti

    CurveGotti Active Member

    Code:
     <xen:include template="block_template">
                <xen:set var="$block">
    </xen:set>
            </xen:include>
    
    lol don't know if this is right either but just trying to brain storm, saw something similar in a template....
     
  7. Mythotical

    Mythotical Well-Known Member

    Thanks Curve, I'll give it a try.
     
  8. Mythotical

    Mythotical Well-Known Member

    Gave that a whirl but something is preventing it. I'll do a var dump to make sure its actually pulling it.
     
  9. Mike

    Mike XenForo Developer Staff Member

    It looks like you're trying to include a template dynamically. You can't do that. Includes are resolved at compile time.

    If you want a template dynamically, you're getting into setting up a view.
     
  10. Mythotical

    Mythotical Well-Known Member

    Ok so guess I can look at the template.php file for a determination of doing this then. Thanks Mike as usual. hehe
     
  11. Mythotical

    Mythotical Well-Known Member

    Mike, could you point me to a file I could use as an example?
     

Share This Page