XF 2.0 Recompile template

AndyB

Well-known member
In an add-on I'm creating, I make changes to the execution order in the xf_template_modification table. Once the changes are made, I would like to recompile the 'account_visitor_menu' template. What code do I need to use in my PHP file? I tried the following but it doesn't work:

PHP:
$template = \XF::app()->find('XF:Template', $templateId);

$template->save();

Thank you.
 
Got it.

PHP:
// get template
$template = \XF::app()->find('XF:Template', $templateId);
        
// set needsSave        
$needsSave = $template->reparseTemplate(true);
        
// this will recompile
$template->save();
 
Top Bottom