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

XF 1.3 How do you reuse or include templates?

Discussion in 'Styling and Customization Questions' started by Razasharp, Feb 10, 2014.

  1. Razasharp

    Razasharp Well-Known Member

    Or the content within them?

    I want to copy the prefix selector from the new thread template, and display it inside the page container template (to show above each forum that has prefixes - so they can be selected easily)

    The code responsible seems to be this:

    Code:
    		<xen:include template="title_prefix_edit">
    			<xen:set var="$selectedPrefix">{$prefixId}</xen:set>
    			<xen:set var="$idSuffix">thread_create</xen:set>
    		</xen:include>
    
    Any ideas on how best to achieve this, or tips on dipping into the XF library generally?
     
  2. Steve F

    Steve F Well-Known Member

    Razasharp likes this.
  3. Razasharp

    Razasharp Well-Known Member

    Thanks Steve, I saw that but it's not quite what I need - I have too many prefixes for them to show as tabs, and I also don't need the amount per prefix.

    I've got a simple drop down working, but I would prefer to use the XF one as it's much nicer :)
     
    Steve F likes this.
  4. Razasharp

    Razasharp Well-Known Member

    Anyone have any info on this please?

    According to the help docs, it should work: http://xenforo.com/help/html-templates/

    Code:
    <xen:include template="template_name" />
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    If the template you are including requires data, you will need to make sure the data is available to it when you attempt to call it.
     
    Razasharp likes this.
  6. Razasharp

    Razasharp Well-Known Member

    Thanks Jeremy.

    Does the data have to be specifically available to the template? (If so how can I go about doing that?)

    I put the code in my first post, in the Page Container template, so was expecting two drop downs for categories to appear on the new thread page - but only the usual one does.
     

Share This Page