View Class Reference

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
| 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
| 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
| 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
Member Data Documentation
| View::$_passedVars = array('viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'viewPath', 'params', 'data', 'webservices', 'plugin') |
| View::$_viewVars = array() |
| View::$controller = null |
The documentation for this class was generated from the following file:
- /cake_1.1.19.6305/cake/libs/view/view.php