A Layout (template) View class.

package Owl
author Dave Widmer

 Methods

Creates a new View instance, if the rendering engine isn't set, it will default to the Mustache engine.

__construct() 
Inherited

inherited_from \Owl\View::__construct()

Allowing access to content properties (if a \Owl\View instance)

__get(string $name) : mixed

Parameters

$name

string

The name of the property to get

Returns

mixed

Checks to see if a variable is available in the content.

__isset(string $name) : boolean

Parameters

$name

string

The name of the property to check

Returns

boolean

Magic "set" method

__set(string $name, mixed $value) 
Inherited

inherited_from \Owl\View::__set()

Parameters

$name

string

The propery name

$value

mixed

The value to set

Renders the view to html.

__toString() : string
Inherited

inherited_from \Owl\View::__toString()

Returns

string

Runs when the view is added to a layout. This will let you assign variables into the layout.

added_to_layout(Layout $layout) 
Inherited

inherited_from \Owl\View::added_to_layout()

Parameters

$layout

\Owl\Layout

The layout that this view was added to

The content that will replace {{> content}} in the layout template.

get_content() : mixed

Returns

mixed

The template rendering engine.

get_engine() : \Owl\Engine
Inherited

inherited_from \Owl\View::get_engine()

Returns

\Owl\EngineThe template rendering engine.

Gets the name of the template file (relative to the template path)

get_file() : string
Inherited

inherited_from \Owl\View::get_file()

Returns

string

Gets the finder.

get_finder() : \Owl\Finder
Inherited

inherited_from \Owl\View::get_finder()

Returns

The partials for this view.

get_partials() : array
Inherited

inherited_from \Owl\View::get_partials()

Returns

array

Loads a template

load(string $file) : string
Inherited

inherited_from \Owl\View::load()

Parameters

$file

string

The path of the template file (relative to the $templates_directory)

Returns

stringThe full template

Pass in the content partials to the rendering function.

render(array $partials) : string

Parameters

$partials

array

An array of partials

Returns

stringThe rendered template

Sets parameters in a batch way.

set(mixed $name, mixed $value) : \Owl\View
Inherited

inherited_from \Owl\View::set()

Parameters

$name

mixed

The property name OR an array of params

$value

mixed

The value of the property if not an array

Returns

\Owl\View$this

Sets the content that will replace {{> content}} in the template. This can be anything that can be echo'ed out, but if it is an \Owl\View class then the added_to_layout function will be called.

set_content(mixed $content) : \Owl\Layout

Parameters

$content

mixed

The content.

Returns

Sets the template rendering engine. The engine is static across all View classes so you will only need to set it once.

set_engine(Engine $engine) 
Inherited

inherited_from \Owl\View::set_engine()

Parameters

$engine

\Owl\Engine

The rendering engine

Set the file finder.

set_finder(Finder $finder) 
Inherited

inherited_from \Owl\View::set_finder()

Parameters

$finder

\Owl\Finder

The file finder class

 Properties

 

The character set for the page

$charset : string

 

An array of css files in a href => , media => format

$css : array

 

An array of js files in a src => format

$js : array

 

An array of metadata in a name => , content => format

$meta : array

 

The page title.

$title : string

 

A list of partials in $name => template

$partials : array
Inherited

inherited_from \Owl\View::$$partials
 

The content to inject into the view.

$content : mixed

 

The rendering engine used to compile the views.

$engine : \Owl\Engine
Inherited

inherited_from \Owl\View::$$engine
 

The class used to find template files

$finder : \Owl\Finder
Inherited

inherited_from \Owl\View::$$finder
 

Does this layout have an \Owl\View?

$has_view : boolean