Files changed (1)
It is also possible to use the static `Template::render()` method to assign variables and execute in a single call.
+Configuration options can be set by passing an associative array of options to the static `Template::setConfig()` method. The options will then be applied to all `Template` objects that are instantiated.
+With this approach only the variables passed as the second parameter are available within `foo.php`. The use of the `static` keyword means that `render()` is called on class that the original `execute()` call was made against. Alternatively, you can use `self::render()` which will call `render()` on the class which included the template file (this would normally be the base `Template` class).
+Using `subRender()` passed all the template variables from the current template to the next template. It doesn't pass any local variables that were defined within the current template file.
+Using `objRender()` instantiates a template of the class specified by the first argument, passes the second argument to the class constructor and assigns the third argument as template variables.
+This approach includes the next template in the same scope as the current template. This means that template variables and also variables defined locally within the current template will be available. The call to `$this->getFileName()` ensures that the correct path and suffix (see Configuration above) are used when including the next template.
Add the following to the requires section in your `composer.json` file and then run `composer install`.