XF 2.0 Parse XenForo template with PHP Code

Jean-Baptiste

Well-known member
Hello,

I have a function that need to parse some alert_content template, and inject some variables in it.

How can I do it with PHP ?

(equivalent of xf:include template=...).

Thanks for the help
 
What do you need to do specifically? You could do a callback (<xf:callback>), though generally if possible, it's ideal to do this stuff outside of the template.
 
Not entirely sure if it fits what you want to do, but you can also call:
PHP:
\XF::app()->templater()->renderTemplate('template_name', $params);
If you're wanting to modify the code of a template at run time, you can use the templater_template_post_render code event.
 
Not entirely sure if it fits what you want to do, but you can also call:
PHP:
\XF::app()->templater()->renderTemplate('template_name', $params);
If you're wanting to modify the code of a template at run time, you can use the templater_template_post_render code event.

That's perfect Chris. Thanks.
 
Back
Top Bottom