• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest New Code Event: template_pre_fetch

Chris D

XenForo developer
Staff member
#1
PHP:
    /**
    * Goes to the data source to load the list of templates.
    *
    * @param array Template list
    *
    * @return array Key-value pairs of template titles/compiled templates
    */
    protected function _getTemplatesFromDataSource(array $templateList)
    {
        XenForo_CodeEvent::fire('template_pre_fetch', array(&$templateList, $this));

        $db = XenForo_Application::getDb();

        return $db->fetchPairs('
            SELECT title, template_compiled
            FROM xf_template_compiled
            WHERE title IN (' . $db->quote($templateList) . ')
                AND style_id = ?
                AND language_id = ?
        ', array(self::$_styleId, self::$_languageId));
    }
This is actually pretty similar to the already existing template_create code event, except this happens only once per page load and $templateList represents a final list of templates to be fetched.