PHP Class ManaPHP\Mvc\View

Inheritance: extends ManaPHP\Component, implements ManaPHP\Mvc\ViewInterface
Datei anzeigen Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_actionName string
$_content string
$_controllerName string
$_layout false | string | null
$_viewVars array

Public Methods

Method Description
_render ( string $template, array $vars, boolean $directOutput ) : string
dump ( )
getActionName ( ) : string Gets the name of the action rendered
getContent ( ) : string Returns cached output from another view stage
getControllerName ( ) : string Gets the name of the controller rendered
getVar ( string $name = null ) : mixed Returns a parameter previously set in the view
partial ( string $path, array $vars = [] ) Renders a partial view
pick ( string $view ) : static Choose a different view to render instead of last-controller/last-action
render ( string $controller, string $action ) : static Executes render process from dispatching data
setContent ( string $content ) : static Externally sets the view content
setLayout ( false | string $layout = 'Default' ) : static
setVar ( string $name, mixed $value ) : static Set a single view parameter
setVars ( array $vars ) : static Adds parameters to view
widget ( string $widget, array $options = [], integer | array $cacheOptions = null )

Method Details

_render() public method

public _render ( string $template, array $vars, boolean $directOutput ) : string
$template string
$vars array
$directOutput boolean
return string

dump() public method

public dump ( )

getActionName() public method

Gets the name of the action rendered
public getActionName ( ) : string
return string

getContent() public method

Returns cached output from another view stage
public getContent ( ) : string
return string

getControllerName() public method

Gets the name of the controller rendered
public getControllerName ( ) : string
return string

getVar() public method

Returns a parameter previously set in the view
public getVar ( string $name = null ) : mixed
$name string
return mixed

partial() public method

Show a partial inside another view $this->partial('shared/footer'); Show a partial inside another view with parameters $this->partial('shared/footer', array('content' => $html));
public partial ( string $path, array $vars = [] )
$path string
$vars array

pick() public method

class ProductsController extends \ManaPHP\Mvc\Controller { public function saveAction() { Do some save stuff... Then show the list view $this->view->pick("products/list"); } }
public pick ( string $view ) : static
$view string
return static

render() public method

Shows recent posts view (app/views/posts/recent.phtml) $view->start()->render('posts', 'recent')->finish();
public render ( string $controller, string $action ) : static
$controller string
$action string
return static

setContent() public method

$this->view->setContent("

hello

");
public setContent ( string $content ) : static
$content string
return static

setLayout() public method

public setLayout ( false | string $layout = 'Default' ) : static
$layout false | string
return static

setVar() public method

$this->view->setVar('products', $products);
public setVar ( string $name, mixed $value ) : static
$name string
$value mixed
return static

setVars() public method

Adds parameters to view
public setVars ( array $vars ) : static
$vars array
return static

widget() public method

public widget ( string $widget, array $options = [], integer | array $cacheOptions = null )
$widget string
$options array
$cacheOptions integer | array

Property Details

$_actionName protected_oe property

protected string $_actionName
return string

$_content protected_oe property

protected string $_content
return string

$_controllerName protected_oe property

protected string $_controllerName
return string

$_layout protected_oe property

protected false|string|null $_layout
return false | string | null

$_viewVars protected_oe property

protected array $_viewVars
return array