Render template from xen:helper

Jake B.

Well-known member
Basically, I'm wanting to create a helper that will render a template, is this possible? I can't seem to find the best way to do this or do I just need to use a template hook? Also, no a template modification is not an option :p
 
Last edited:

Jake B.

Well-known member
Ended up just using a template hook for this. However, that is causing template hooks within that template not to fire :\
 

Chris D

XenForo developer
Staff member
Should just be a case of creating the appropriate template object and returning that:
PHP:
return new XenForo_Template_Public($templateName, $params);
 
Last edited:

Jake B.

Well-known member
Should just be a case of creating the appropriate template object and returning that:
PHP:
return new XenForo_Template_Public($templateName, $params);

I'm trying to do this with navigation, and it appears at least that included templates aren't included and the template name is just rendered instead

Screen%20Shot%202016-08-01%20at%209.35.34%20AM.png
Any way to make that happen?
 

Chris D

XenForo developer
Staff member
Template includes should just work:
PHP:
public static function helperTemplateTest()
{
   return new XenForo_Template_Public('test1');
}

test1:
HTML:
This is template 1

<xen:include template="test2" />

test2:
HTML:
This is template 2

Output when the template helper is called:

upload_2016-8-1_15-54-32.png
 

Jake B.

Well-known member
Ah, nevermind the subnavigation links aren't using an include, it just has the template name so I'll need to do the include manually. I'll dig into this a bit more, thanks!
 
Top