View Class Reference

Inheritance diagram for View:

Object

List of all members.


Public Member Functions

 _getLayoutFileName ()
 _getViewFileName ($action)
_loadHelpers (&$loaded, $helpers)
 _render ($___viewFn, $___dataForView, $loadHelpers=true, $cached=false)
 element ($name, $params=array())
 error ($code, $name, $message)
 pluginView ($action, $layout)
 render ($action=null, $layout=null, $file=null)
 renderCache ($filename, $timeStart)
 renderElement ($name, $params=array())
 renderLayout ($contentForLayout)
 setLayout ($layout)

Public Attributes

 $_hasRendered = null
 $_passedVars = array('viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'viewPath', 'params', 'data', 'webservices', 'plugin')
 $_viewVars = array()
 $action = null
 $autoLayout = true
 $autoRender = true
 $base = null
 $controller = null
 $ext = '.thtml'
 $helpers = array('Html')
 $here = null
 $layout = 'default'
 $loaded = array()
 $name = null
 $pageTitle = false
 $params
 $plugin = null
 $pluginPath = null
 $pluginPaths = array()
 $subDir = null
 $themeWeb = null
 $viewPath
 $viewVars = array()

Detailed Description

Definition at line 39 of file view.php.


Member Function Documentation

View::_getLayoutFileName (  ) 

Returns layout filename for this template as a string.

Returns:
string Filename for layout file (.thtml). protected

Definition at line 537 of file view.php.

References $paths, and Configure::getInstance().

View::_getViewFileName ( action  ) 

Returns filename of given action's template file (.thtml) as a string. CamelCased action names will be under_scored! This means that you can have LongActionNames that refer to long_action_names.thtml views.

Parameters:
string $action Controller action to find template filename for
Returns:
string Template filename protected

Definition at line 488 of file view.php.

References $paths, Configure::getInstance(), and Inflector::underscore().

& View::_loadHelpers ( &$  loaded,
helpers 
)

Loads helpers, with their dependencies.

Parameters:
array $loaded List of helpers that are already loaded.
array $helpers List of helpers to load.
Returns:
array protected

Definition at line 645 of file view.php.

References Inflector::underscore(), and Inflector::variable().

View::_render ( ___viewFn,
___dataForView,
loadHelpers = true,
cached = false 
)

Renders and returns output for given view filename with its array of data.

Parameters:
string $___viewFn Filename of the view
array $___dataForView Data to include in rendered view
Returns:
string Rendered output protected

Definition at line 577 of file view.php.

Referenced by render(), and renderLayout().

View::element ( name,
params = array() 
)

Wrapper for View::renderElement();

Parameters:
string $name Name of template file in the/app/views/elements/ folder
array $params Array of data to be made available to the for rendered view (i.e. the Element)
Returns:
string View::renderElement() public

Definition at line 398 of file view.php.

View::error ( code,
name,
message 
)

Displays an error page to the user. Uses layouts/error.html to render the page.

Parameters:
int $code HTTP Error code (for instance: 404)
string $name Name of the error (for instance: Not Found)
string $message Error message as a web page
Returns:
rendered error message public

Definition at line 475 of file view.php.

View::pluginView ( action,
layout 
)

Returns a plugin view

Parameters:
string $action Name of action to render for
string $layout Layout to use
Returns:
mixed View::render() if template is found, error if template is missing public

Definition at line 717 of file view.php.

View::render ( action = null,
layout = null,
file = null 
)

Renders view for given action and layout. If $file is given, that is used for a view filename (e.g. customFunkyView.thtml).

Parameters:
string $action Name of action to render for
string $layout Layout to use
string $file Custom filename for view
Returns:
mixed returns an error if View::render() fails to find a related template. boolean on successful render public

Definition at line 238 of file view.php.

References $file, _render(), Configure::read(), and Inflector::underscore().

View::renderCache ( filename,
timeStart 
)

Renders a cached view if timestamp in file is less or equal to current time.

If $layout is xml content type will be set before rendering the cache

Parameters:
string $filename
int $timeStart
Returns:
mixed outputs view, or returns void if timestamp has expired public

Definition at line 740 of file view.php.

References $filename, and Configure::read().

View::renderElement ( name,
params = array() 
)

Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.

This realizes the concept of Elements, (or "partial layouts") and the $params array is used to send data to be used in the Element.

Parameters:
string $name Name of template file in the/app/views/elements/ folder
array $params Array of data to be made available to the for rendered view (i.e. the Element)
Returns:
string Rendered output public

Definition at line 351 of file view.php.

References $file, $paths, Configure::getInstance(), and Configure::read().

View::renderLayout ( contentForLayout  ) 

Renders a layout. Returns output from _render(). Returns false on error.

Parameters:
string $contentForLayout Content to render in a view, wrapped by the surrounding layout.
Returns:
mixed Rendered output, or false on error public

Definition at line 408 of file view.php.

References _render(), Inflector::humanize(), and Configure::read().

View::setLayout ( layout  ) 

Sets layout to be used when rendering.

Parameters:
string $layout Name of layout.
Returns:
void public
Deprecated:
in 1.2.x.x

Definition at line 462 of file view.php.


Member Data Documentation

View::$_hasRendered = null

Definition at line 136 of file view.php.

View::$_passedVars = array('viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'viewPath', 'params', 'data', 'webservices', 'plugin')

Definition at line 197 of file view.php.

View::$_viewVars = array()

Replaced with public var viewVars protected

Deprecated:

Definition at line 80 of file view.php.

View::$action = null

Definition at line 60 of file view.php.

View::$autoLayout = true

Definition at line 122 of file view.php.

View::$autoRender = true

Definition at line 115 of file view.php.

View::$base = null

Definition at line 101 of file view.php.

View::$controller = null

Deprecated:
will not be avialable after 1.1.x.x

Definition at line 140 of file view.php.

View::$ext = '.thtml'

Definition at line 154 of file view.php.

View::$helpers = array('Html')

Definition at line 67 of file view.php.

View::$here = null

Definition at line 53 of file view.php.

View::$layout = 'default'

Definition at line 108 of file view.php.

View::$loaded = array()

Definition at line 147 of file view.php.

View::$name = null

Definition at line 46 of file view.php.

View::$pageTitle = false

Definition at line 94 of file view.php.

View::$params

Definition at line 129 of file view.php.

View::$plugin = null

Definition at line 176 of file view.php.

View::$pluginPath = null

Definition at line 182 of file view.php.

View::$pluginPaths = array()

Definition at line 190 of file view.php.

View::$subDir = null

Definition at line 161 of file view.php.

View::$themeWeb = null

Definition at line 168 of file view.php.

View::$viewPath

Definition at line 74 of file view.php.

View::$viewVars = array()

Definition at line 87 of file view.php.


The documentation for this class was generated from the following file: