1. 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

Discussion in 'Closed Suggestions' started by Chris D, Feb 15, 2014.

  1. Chris D

    Chris D XenForo Developer Staff Member

    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::$_styleIdself::$_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.
     

Share This Page