\Anax\ViewCViewContainer

A view container, store all views per region, render at will.

Summary

Methods
Properties
Constants
configure()
setDI()
getTemplateFile()
add()
addCallback()
addString()
hasContent()
render()
No public properties found
No constants found
No protected methods found
$di
N/A
No private methods found
$config
$views
N/A

Properties

$di

$di : 

Properties

Type

$config

$config : 

Properties

Type

$views

$views : 

Properties

Type

Methods

configure()

configure(\Anax\array/string  $what) : $this

Read configuration from file or array'.

Parameters

\Anax\array/string $what

is an array with key/value config options or a file to be included which returns such an array.

Returns

$this —

for chaining.

setDI()

setDI(\Anax\DI\class  $di) : $this

Set the service container to use

Parameters

\Anax\DI\class $di

a service container

Returns

$this

getTemplateFile()

getTemplateFile(string  $template) : string

Convert template to path to template file.

Parameters

string $template

the name of the template file to include

Throws

\Anax\View\Anax\View\Exception

when template file is missing

Returns

string —

as path to the template file

add()

add(string  $template, array  $data = array(), string  $region = "main", integer  $sort) : $this

Add a view to be included as a template file.

Parameters

string $template

the name of the template file to include

array $data

variables to make available to the view, default is empty

string $region

which region to attach the view

integer $sort

which order to display the views

Returns

$this

addCallback()

addCallback(string  $callback, array  $data = array(), string  $region = "main", integer  $sort) : $this

Add a callback to be rendered as a view.

Parameters

string $callback

function to call to get the content of the view

array $data

variables to make available to the view, default is empty

string $region

which region to attach the view

integer $sort

which order to display the views

Returns

$this

addString()

addString(string  $content, string  $region = "main", integer  $sort) : $this

Add a string as a view.

Parameters

string $content

the content

string $region

which region to attach the view

integer $sort

which order to display the views

Returns

$this

hasContent()

hasContent(string  $region) : $this

Check if a region has views to render.

Parameters

string $region

which region to check

Returns

$this

render()

render(string  $region = "main") : $this

Render all views for a specific region.

Parameters

string $region

which region to use

Returns

$this