View Class Reference

Inheritance diagram for View:

Object MediaView ThemeView ScaffoldView List of all members.

Public Member Functions

 __construct (&$controller, $register=true)
 _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)
 _triggerHelpers ($callback)
 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

 $__passedVars
 $__paths = array()
 $__scripts = array()
 $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 37 of file view.php.


Constructor & Destructor Documentation

View::__construct ( &$  controller,
register = true 
)

Constructor

Returns:
View

Definition at line 265 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 838 of file view.php.

References $path, ext(), and underscore().

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 780 of file view.php.

References $path, ext(), Configure::read(), and 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 704 of file view.php.

References App::import(), params(), and 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 866 of file view.php.

References name().

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 892 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 647 of file view.php.

References $out, cache(), name(), Configure::read(), and variable().

Referenced by render(), and renderLayout().

View::_triggerHelpers ( callback  ) 

Fire a callback on all loaded Helpers

Parameters:
string $callback name of callback fire. protected
Returns:
void

Definition at line 477 of file view.php.

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
Returns:
void public

Definition at line 551 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. Elements can be cached through use of the cache key.

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) Special params: cache - enable caching for this element accepts boolean or strtotime compatible string. Can also be an array if an array,'time' is used to specify duration of cache. 'key' can be used to create unique cache files.
Returns:
string Rendered Element public

Definition at line 298 of file view.php.

References $path, cache(), ext(), Configure::read(), and 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 584 of file view.php.

References Set::filter().

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 631 of file view.php.

References error(), and name().

Referenced by ScaffoldView::_getViewFileName().

View::getVar ( var  ) 

Returns the contents of the given View variable(s)

Returns:
array public

Definition at line 535 of file view.php.

View::getVars (  ) 

Returns a list of variables available in the current View context

Returns:
array public

Definition at line 526 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 364 of file view.php.

References $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 497 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 922 of file view.php.

View::renderLayout ( content_for_layout,
layout = null 
)

Renders a layout. Returns output from _render(). Returns false on error. Several variables are created for use in layout. title_for_layout - contains page title content_for_layout - contains rendered view file scripts_for_layout - contains scripts added to header cakeDebug - if debug is on, cake debug information is added.

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 418 of file view.php.

References __(), _render(), element(), 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 600 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 568 of file view.php.

References $url, md5(), and Router::url().


Member Data Documentation

View::$__passedVars

Initial value:

 array(
        'viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot',
        'helpers', 'here', 'layout', 'name', 'pageTitle', 'layoutPath', 'viewPath',
        'params', 'data', 'plugin', 'passedArgs', 'cacheAction'
    )

Definition at line 242 of file view.php.

View::$__paths = array()

Definition at line 259 of file view.php.

View::$__scripts = array()

Definition at line 253 of file view.php.

View::$action = null

Definition at line 71 of file view.php.

View::$association = null

Definition at line 205 of file view.php.

View::$autoLayout = true

Definition at line 143 of file view.php.

View::$autoRender = true

Definition at line 136 of file view.php.

View::$base = null

Definition at line 44 of file view.php.

View::$cacheAction = false

Definition at line 169 of file view.php.

View::$data = array()

Definition at line 89 of file view.php.

View::$ext = '.ctp'

Definition at line 149 of file view.php.

Referenced by ScaffoldView::_getViewFileName().

View::$field = null

Definition at line 211 of file view.php.

View::$fieldSuffix = null

Definition at line 217 of file view.php.

View::$hasRendered = false

Definition at line 181 of file view.php.

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

Definition at line 96 of file view.php.

View::$here = null

Definition at line 50 of file view.php.

View::$layout = 'default'

Definition at line 116 of file view.php.

View::$layoutPath = null

Definition at line 122 of file view.php.

View::$loaded = array()

Definition at line 187 of file view.php.

View::$model = null

Definition at line 199 of file view.php.

View::$modelId = null

Definition at line 223 of file view.php.

View::$modelScope = false

Definition at line 193 of file view.php.

View::$name = null

Definition at line 64 of file view.php.

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

View::$output = false

Definition at line 235 of file view.php.

View::$pageTitle = false

Definition at line 129 of file view.php.

View::$params = array()

Definition at line 77 of file view.php.

View::$passedArgs = array()

Definition at line 83 of file view.php.

View::$plugin = null

Definition at line 57 of file view.php.

Referenced by ThemeView::_paths().

View::$subDir = null

Definition at line 155 of file view.php.

Referenced by ScaffoldView::_getViewFileName().

View::$themeWeb = null

Definition at line 161 of file view.php.

View::$uuids = array()

Definition at line 229 of file view.php.

View::$validationErrors = array()

Definition at line 175 of file view.php.

View::$viewPath = null

Definition at line 102 of file view.php.

View::$viewVars = array()

Definition at line 109 of file view.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:57 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7