1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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

Discussion in 'Development Tutorials [Archive]' started by Rigel Kentaurus, Oct 6, 2010.

  1. Rigel Kentaurus

    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)
     
    wwwicked likes this.
  2. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    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.
     
  3. wwwicked

    wwwicked Active Member

    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.
     

Share This Page