View Class Reference

Inheritance diagram for View:

Object MediaView ThemeView ScaffoldView

List of all members.


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  ) 

Returns layout filename for this template as a string.

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

Definition at line 816 of file view.php.

References $file.

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 
)

Adds a script block or other element to be inserted in $scripts_for_layout in the <head> of a document layout

Parameters:
string $name
string $content public

Definition at line 526 of file view.php.

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  ) 

Returns the contents of the given View variable(s)

Returns:
array public

Definition at line 511 of file view.php.

View::getVars (  ) 

Returns a list of variables available in the current View context

Returns:
array public

Definition at line 502 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.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 
)

Deprecated:
See also:
View::element

Definition at line 902 of file view.php.

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

Definition at line 574 of file view.php.

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::$action = null

Definition at line 74 of file view.php.

View::$association = null

Definition at line 208 of file view.php.

View::$autoLayout = true

Definition at line 146 of file view.php.

View::$autoRender = true

Definition at line 139 of file view.php.

View::$base = null

Definition at line 47 of file view.php.

View::$cacheAction = false

Definition at line 172 of file view.php.

View::$data = array()

Definition at line 92 of file view.php.

View::$ext = '.ctp'

Definition at line 152 of file view.php.

View::$field = null

Definition at line 214 of file view.php.

View::$fieldSuffix = null

Definition at line 220 of file view.php.

View::$hasRendered = false

Definition at line 184 of file view.php.

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

Definition at line 99 of file view.php.

View::$here = null

Definition at line 53 of file view.php.

View::$layout = 'default'

Definition at line 119 of file view.php.

View::$layoutPath = null

Definition at line 125 of file view.php.

View::$loaded = array()

Definition at line 190 of file view.php.

View::$model = null

Definition at line 202 of file view.php.

View::$modelId = null

Definition at line 226 of file view.php.

View::$modelScope = false

Definition at line 196 of file view.php.

View::$name = null

Definition at line 67 of file view.php.

Referenced by ScaffoldView::_getViewFileName(), and MediaView::render().

View::$output = false

Definition at line 238 of file view.php.

View::$pageTitle = false

Definition at line 132 of file view.php.

View::$params = array()

Definition at line 80 of file view.php.

View::$passedArgs = array()

Definition at line 86 of file view.php.

View::$plugin = null

Definition at line 60 of file view.php.

Referenced by ThemeView::_paths().

View::$subDir = null

Definition at line 158 of file view.php.

Referenced by ScaffoldView::_getViewFileName().

View::$themeWeb = null

Definition at line 164 of file view.php.

View::$uuids = array()

Definition at line 232 of file view.php.

View::$validationErrors = array()

Definition at line 178 of file view.php.

View::$viewPath = null

Definition at line 105 of file view.php.

View::$viewVars = array()

Definition at line 112 of file view.php.


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