View Class Reference

Public Member Functions | |
| _getLayoutFileName ($name=null) | |
| _getViewFileName ($name=null) | |
| & | _loadHelpers (&$loaded, $helpers, $parent=null) |
| _missingView ($file, $error= 'missingView') | |
| _paths ($plugin=null, $cached=true) | |
| _render ($___viewFn, $___dataForView, $loadHelpers=true, $cached=false) | |
| addScript ($name, $content=null) | |
| element ($name, $params=array(), $loadHelpers=false) | |
| entity () | |
| error ($code, $name, $message) | |
| getVar ($var) | |
| getVars () | |
| render ($action=null, $layout=null, $file=null) | |
| renderCache ($filename, $timeStart) | |
| renderElement ($name, $params=array(), $loadHelpers=false) | |
| renderLayout ($content_for_layout, $layout=null) | |
| set ($one, $two=null) | |
| uuid ($object, $url) | |
Public Attributes | |
| $action = null | |
| $association = null | |
| $autoLayout = true | |
| $autoRender = true | |
| $base = null | |
| $cacheAction = false | |
| $data = array() | |
| $ext = '.ctp' | |
| $field = null | |
| $fieldSuffix = null | |
| $hasRendered = false | |
| $helpers = array('Html') | |
| $here = null | |
| $layout = 'default' | |
| $layoutPath = null | |
| $loaded = array() | |
| $model = null | |
| $modelId = null | |
| $modelScope = false | |
| $name = null | |
| $output = false | |
| $pageTitle = false | |
| $params = array() | |
| $passedArgs = array() | |
| $plugin = null | |
| $subDir = null | |
| $themeWeb = null | |
| $uuids = array() | |
| $validationErrors = array() | |
| $viewPath = null | |
| $viewVars = array() | |
Detailed Description
Definition at line 40 of file view.php.
Member Function Documentation
| View::_getLayoutFileName | ( | $ | name = null |
) |
| View::_getViewFileName | ( | $ | name = null |
) |
Returns filename of given action's template file (.ctp) as a string. CamelCased action names will be under_scored! This means that you can have LongActionNames that refer to long_action_names.ctp views.
- Parameters:
-
string $action Controller action to find template filename for
- Returns:
- string Template filename protected
Reimplemented in ScaffoldView.
Definition at line 758 of file view.php.
References Configure::read(), and Inflector::underscore().
| & View::_loadHelpers | ( | &$ | loaded, | |
| $ | helpers, | |||
| $ | parent = null | |||
| ) |
Loads helpers, with their dependencies.
- Parameters:
-
array $loaded List of helpers that are already loaded. array $helpers List of helpers to load. string $parent holds name of helper, if loaded helper has helpers
- Returns:
- array
Definition at line 685 of file view.php.
References App::import(), params(), and Inflector::underscore().
| View::_missingView | ( | $ | file, | |
| $ | error = 'missingView' | |||
| ) |
Return a misssing view error message
- Parameters:
-
string $viewFileName the filename that should exist
- Returns:
- cakeError
Definition at line 845 of file view.php.
References $file.
Referenced by ScaffoldView::_getViewFileName().
| View::_paths | ( | $ | plugin = null, |
|
| $ | cached = true | |||
| ) |
Return all possible paths to find view files in order
- Parameters:
-
string $plugin
- Returns:
- array paths protected
Reimplemented in ThemeView.
Definition at line 872 of file view.php.
References Configure::read().
| 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 621 of file view.php.
References $out, cache(), Configure::read(), and Inflector::variable().
Referenced by render(), and renderLayout().
| View::addScript | ( | $ | name, | |
| $ | content = null | |||
| ) |
| View::element | ( | $ | name, | |
| $ | params = array(), |
|||
| $ | loadHelpers = false | |||
| ) |
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 Element public
Definition at line 290 of file view.php.
References $file, cache(), Configure::read(), and Inflector::slug().
Referenced by renderLayout().
| View::entity | ( | ) |
Returns the entity reference of the current context as an array of identity parts
- Returns:
- array An array containing the identity elements of an entity
Definition at line 559 of file view.php.
References Set::filter(), and ife().
| View::error | ( | $ | code, | |
| $ | name, | |||
| $ | message | |||
| ) |
Displays an error page to the user. Uses layouts/error.ctp to render the page.
- Parameters:
-
integer $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
Definition at line 605 of file view.php.
Referenced by ScaffoldView::_getViewFileName().
| View::getVar | ( | $ | var | ) |
| View::getVars | ( | ) |
| 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.ctp).
- Parameters:
-
string $action Name of action to render for string $layout Layout to use string $file Custom filename for view
- Returns:
- string Rendered Element
Definition at line 356 of file view.php.
References $file, $out, _render(), cache(), and Configure::read().
| View::renderCache | ( | $ | filename, | |
| $ | timeStart | |||
| ) |
Render cached view
- Parameters:
-
string $filename the cache file to include string $timeStart the page render start time
Definition at line 472 of file view.php.
References $filename, $out, and Configure::read().
| View::renderElement | ( | $ | name, | |
| $ | params = array(), |
|||
| $ | loadHelpers = false | |||
| ) |
| View::renderLayout | ( | $ | content_for_layout, | |
| $ | layout = null | |||
| ) |
Renders a layout. Returns output from _render(). Returns false on error.
- Parameters:
-
string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
- Returns:
- mixed Rendered output, or false on error
Definition at line 399 of file view.php.
References _render(), element(), Inflector::humanize(), and Configure::read().
| View::set | ( | $ | one, | |
| $ | two = null | |||
| ) |
Allows a template or element to set a variable that will be available in a layout or other element. Analagous to Controller::set.
- Parameters:
-
mixed $one A string or an array of data. mixed $two Value in case $one is a string (which then works as the key). Unused if $one is an associative array, otherwise serves as the values to $one's keys.
- Returns:
- unknown
| View::uuid | ( | $ | object, | |
| $ | url | |||
| ) |
Generates a unique, non-random DOM ID for an object, based on the object type and the target URL.
- Parameters:
-
string $object Type of object, i.e. 'form' or 'link' string $url The object's target URL
- Returns:
- string public
Definition at line 543 of file view.php.
References $url, and Router::url().
Member Data Documentation
| View::$name = null |
Definition at line 67 of file view.php.
Referenced by ScaffoldView::_getViewFileName(), and MediaView::render().
| View::$plugin = null |
| View::$subDir = null |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/view/view.php