Cake\View\StringTemplate::load PHP Method

load() public method

Template files should define a $config variable containing all the templates to load. Loaded templates will be merged with existing templates.
public load ( string $file ) : void
$file string The file to load
return void
    public function load($file)
    {
        $loader = new PhpConfig();
        $templates = $loader->read($file);
        $this->add($templates);
    }

Usage Example

 /**
  * templater
  *
  * @return \Cake\View\StringTemplate
  */
 public function templater()
 {
     if (empty($this->_templater)) {
         $class = $this->config('templateClass') ?: 'Cake\\View\\StringTemplate';
         $this->_templater = new $class();
         $templates = $this->config('templates');
         if ($templates) {
             if (is_string($templates)) {
                 $this->_templater->add($this->_defaultConfig['templates']);
                 $this->_templater->load($templates);
             } else {
                 $this->_templater->add($templates);
             }
         }
     }
     return $this->_templater;
 }