\Anax\ViewViewRenderFile2

Render a view based on a template file and a dataset.

Summary

Methods
Properties
Constants
configure()
getConfig()
setDI()
render()
asset()
url()
renderView()
regionHasContent()
renderRegion()
classList()
currentUrl()
currentRoute()
No public properties found
No constants found
No protected methods found
$config
$di
N/A
No private methods found
No private properties found
N/A

Properties

$config

$config : array<mixed,>

Type

array<mixed,> — store the configuration in this array.

$di

$di : \Anax\DI\Anax\DI\DIInterface

Type

\Anax\DI\Anax\DI\DIInterface — the DI service container.

Methods

configure()

configure(array|string  $what) : self

Read configuration from file or array, if a file, first check in ANAX_APP_PATH/config and then in ANAX_INSTALL_PATH/config.

Parameters

array|string $what

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

Throws

\Anax\Configure\Exception

when argument if not a file nor an array.

Returns

self —

for chaining.

getConfig()

getConfig(string  $key, string  $default = null) : mixed

Helper function for reading values from the configuration and appy default values where configuration item is missing.

Parameters

string $key

matching a key in the config array.

string $default

value returned when config item is not found.

Returns

mixed —

or null if key does not exists.

setDI()

setDI(\Anax\DI\Anax\DI\DIInterface  $di) : self

Set the service container to use

Parameters

\Anax\DI\Anax\DI\DIInterface $di

a service container

Returns

self

render()

render(string  $file, array  $data) : void

Render the view file.

Parameters

string $file

to include as view file.

array $data

to expose within the view.

Throws

\Anax\View\Exception

when template file is not found.

asset()

asset(  $url = "") 

TODO: Remove when updating oophp to new view classes. Its here for backward compability with views from oophp that used the trait ViewHelperTrait for view helpers which is now obsolete.

Parameters

$url

url()

url(  $url = "") 

Parameters

$url

renderView()

renderView(  $template,   $data = array()) 

Parameters

$template
$data

regionHasContent()

regionHasContent(  $region) 

Parameters

$region

renderRegion()

renderRegion(  $region) 

Parameters

$region

classList()

classList(  $args) 

Parameters

$args

currentUrl()

currentUrl() 

currentRoute()

currentRoute()