class View (View source)

Constants

UNSAFE

Methods

static 
setEncoding($value)

Set encoding used by escape engine

static bool
strict(bool $enable)

Enables or disables strict mode to pre-check for the existence of the view.

static 
forceRender()

Force the View::render method to render at the time it is called

static 
dispatch()

Starts rendering of registered views.

static 
data(string $key, mixed $value)

Share or remove shared data to Views, shared variables will be added as variables to the views that will be executed later

static bool
exists(string $view)

Check if view exists in ./application/View/ folder

static int|null
render(string $view, array $data = array(), int $mode = null)

Register or render a View. If View is registered this method returns the index number from View

static 
once(string $view, array $data = array(), int $mode = ENT_COMPAT)

This method is similar to ::render(), except that the view will only be rendered once, ignoring subsequent calls.

static 
remove(int $index)

Remove a registered View by index

Details

static setEncoding($value)

Set encoding used by escape engine

Parameters

$value

static bool strict(bool $enable)

Enables or disables strict mode to pre-check for the existence of the view.

  • Note: When enabled, it performs a case-sensitive check on systems that do not support it
  • Note: In development environment, the framework will enable this by default
  • Note: In production environment, it is recommended to disable it for performance reasons

Parameters

bool $enable

Return Value

bool

Exceptions

Exception

static forceRender()

Force the View::render method to render at the time it is called

static dispatch()

Starts rendering of registered views.

Executes all registered views and forces immediate rendering for subsequent calls.

static data(string $key, mixed $value)

Share or remove shared data to Views, shared variables will be added as variables to the views that will be executed later

Parameters

string $key
mixed $value

static bool exists(string $view)

Check if view exists in ./application/View/ folder

Parameters

string $view

Return Value

bool

static int|null render(string $view, array $data = array(), int $mode = null)

Register or render a View. If View is registered this method returns the index number from View

Parameters

string $view

View path

array $data

Array that will be extracted to variables in the view

int $mode

Supported flags (may vary depending on the version):

  • ENT_COMPAT
  • ENT_QUOTES
  • ENT_NOQUOTES
  • ENT_IGNORE
  • ENT_SUBSTITUTE
  • ENT_DISALLOWED
  • ENT_HTML401
  • ENT_XML1
  • ENT_XHTML
  • ENT_HTML5

Return Value

int|null

Exceptions

Exception

static once(string $view, array $data = array(), int $mode = ENT_COMPAT)

This method is similar to ::render(), except that the view will only be rendered once, ignoring subsequent calls.

Parameters

string $view
array $data
int $mode

Exceptions

Exception

static remove(int $index)

Remove a registered View by index

Parameters

int $index