• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

How to recompile templates and phrases

Rigel Kentaurus

Well-known member
The following code snippet will "force" to recompile all templates and phrases

For phrases (change languageId to yours)
Code:
    $p = new XenForo_Model_Phrase();
    $p->compileAllPhrasesInLanguage(1);

For templates
Code:
    $t = new XenForo_Model_Template();
    $t->compileAllTemplates();

If you just need to run it for whatever reason you could add it in index.php just before fc->run() (or create a separate file, or add it to a code event)
 
Some funs facts I have been finding today ...

Phrases are both in xf_phrase and xf_phrase_compiled

The templates most of the time have the phrases already IN the template, meaning that the compiled template is now language specific. This is a nice performance enhancement, but sadly it also means that if you modify the phrase IN the table for whatever reason, you will need to recompile templates.
 
Could be useful, thanks. I managed to kill my forum earlier by installing an Add-On before I'd uploaded the actual code into the /library/ directory.
 
Top Bottom