Contao\TemplateLoader::initialize PHP Метод

initialize() публичный статический Метод

Find the templates in the Contao resource folders.
public static initialize ( )
    public static function initialize()
    {
        $strCacheDir = \System::getContainer()->getParameter('kernel.cache_dir');
        // Try to load from cache
        if (file_exists($strCacheDir . '/contao/config/templates.php')) {
            self::addFiles(include $strCacheDir . '/contao/config/templates.php');
        } else {
            try {
                foreach (\System::getContainer()->get('contao.resource_finder')->findIn('templates')->name('*.html5') as $file) {
                    self::addFile($file->getBasename('.html5'), $file->getPath());
                }
            } catch (\InvalidArgumentException $e) {
            }
        }
    }

Usage Example

Пример #1
0
 /**
  * Initializes the framework.
  */
 private function initializeFramework()
 {
     // Set the error_reporting level
     error_reporting($this->errorLevel);
     $this->includeHelpers();
     $this->includeBasicClasses();
     // Set the container
     System::setContainer($this->container);
     /** @var Config $config */
     $config = $this->getAdapter(Config::class);
     // Preload the configuration (see #5872)
     $config->preload();
     // Register the class loader
     ClassLoader::scanAndRegister();
     $this->initializeLegacySessionAccess();
     $this->setDefaultLanguage();
     // Fully load the configuration
     $config->getInstance();
     $this->validateInstallation();
     Input::initialize();
     TemplateLoader::initialize();
     $this->setTimezone();
     $this->triggerInitializeSystemHook();
     $this->handleRequestToken();
 }