\Disco\classesTemplate

Template class.

Extend \Twig_Environment to provide extra functionality..

Summary

Methods
Properties
Constants
defaultLoader()
__construct()
isTemplate()
render()
with()
build()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

defaultLoader()

defaultLoader(null|string|array  $path = null) : \Disco\classes\TemplateLoader

Get the default disco twig loader which enables extension-less template use.

Parameters

null|string|array $path

The absolute path to the template directory, or an array of directories.

Returns

\Disco\classes\TemplateLoader

__construct()

__construct(null|\Twig_Loader_Filesystem|\Twig_Loader_Array  $loader = null, null|string|array  $options = 'app/config/twig.php') 

Construct the \Twig_Environment.

Parameters

null|\Twig_Loader_Filesystem|\Twig_Loader_Array $loader

The loader in charge of finding twig templates.

null|string|array $options

Either a relative string path to the twig configuration options, an array of configuration options, or null for no options.

isTemplate()

isTemplate(string  $name) : boolean

Is the file a template that exists?

Parameters

string $name

The template.

Returns

boolean —

Whether the template exists.

render()

render(string  $name, array  $data = array()) : string

Render a template resolving any aliases used in the template name path.

Parameters

string $name

The template name.

array $data

The variables to pass into the template.

Returns

string —

The rendered template.

with()

with(string  $name, array  $data = array()) : void

Build a template and push its html onto the Views html stack.

Parameters

string $name

The template name.

array $data

The data to pass the template.

build()

build(string  $name, array  $data = array()) : string

Build a template.

Parameters

string $name

The template name.

array $data

The data to pass the template.

Returns

string