2005-07-02 22:49:04 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
/* SVN FILE: $Id$ */
|
2005-06-21 23:44:49 +00:00
|
|
|
|
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Methods for displaying presentation data in the view.
|
2005-12-27 03:33:44 +00:00
|
|
|
*
|
2005-08-21 06:49:02 +00:00
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
2006-01-20 07:46:14 +00:00
|
|
|
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
2005-12-23 21:57:26 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
2005-12-27 03:33:44 +00:00
|
|
|
*
|
2005-12-23 21:57:26 +00:00
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
2005-08-21 06:49:02 +00:00
|
|
|
*
|
2005-12-27 03:33:44 +00:00
|
|
|
* @filesource
|
2006-01-20 07:46:14 +00:00
|
|
|
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
2005-12-23 21:57:26 +00:00
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
2005-08-21 06:49:02 +00:00
|
|
|
* @package cake
|
2005-10-09 01:56:21 +00:00
|
|
|
* @subpackage cake.cake.libs.view
|
|
|
|
* @since CakePHP v 0.10.0.1076
|
2005-08-21 06:49:02 +00:00
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
2005-06-21 23:44:49 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
/**
|
2006-02-18 23:42:21 +00:00
|
|
|
* Included libraries.
|
|
|
|
*/
|
2005-12-27 03:33:44 +00:00
|
|
|
uses(DS.'view'.DS.'helper');
|
2005-07-02 22:49:04 +00:00
|
|
|
|
|
|
|
/**
|
2005-12-22 01:07:28 +00:00
|
|
|
* View, the V in the MVC triad.
|
2005-08-21 06:49:02 +00:00
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* Class holding methods for displaying presentation data.
|
2005-07-02 22:49:04 +00:00
|
|
|
*
|
2005-12-27 03:33:44 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.view
|
|
|
|
* @since CakePHP v 0.10.0.1076
|
2005-07-02 22:49:04 +00:00
|
|
|
*/
|
|
|
|
class View extends Object
|
|
|
|
{
|
2005-07-10 05:08:19 +00:00
|
|
|
/**
|
|
|
|
* Name of the controller.
|
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var string Name of controller
|
2005-07-10 05:08:19 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $name = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores the current URL (for links etc.)
|
|
|
|
*
|
|
|
|
* @var string Current URL
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $here = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2006-01-20 07:46:14 +00:00
|
|
|
* Not used. 2006-09
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $parent = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Action to be performed.
|
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var string Name of action
|
2005-07-10 05:08:19 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $action = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An array of names of models the particular controller wants to use.
|
|
|
|
*
|
|
|
|
* @var mixed A single name as a string or a list of names as an array.
|
|
|
|
* @access protected
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $uses = false;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An array of names of built-in helpers to include.
|
|
|
|
*
|
|
|
|
* @var mixed A single name as a string or a list of names as an array.
|
|
|
|
* @access protected
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $helpers = array('Html');
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Path to View.
|
2005-07-21 04:02:32 +00:00
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var string Path to View
|
2005-07-21 04:02:32 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $viewPath;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Variables for the view
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $_viewVars = array();
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Title HTML element of this View.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $pageTitle = false;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An array of model objects.
|
|
|
|
*
|
|
|
|
* @var array Array of model objects.
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $models = array();
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Path parts for creating links in views.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var string Base URL
|
2005-07-10 05:08:19 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $base = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Name of layout to use with this View.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $layout = 'default';
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Turns on or off Cake's conventional mode of rendering views. On by default.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $autoRender = true;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Turns on or off Cake's conventional mode of finding layout files. On by default.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $autoLayout = true;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Array of parameter data
|
2005-07-21 04:02:32 +00:00
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var array Parameter data
|
2005-07-21 04:02:32 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $params;
|
2005-07-21 04:02:32 +00:00
|
|
|
/**
|
2005-10-18 22:27:39 +00:00
|
|
|
* True when the view has been rendered.
|
2005-07-21 04:02:32 +00:00
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @var boolean
|
2005-07-21 04:02:32 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $hasRendered = null;
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-09-17 07:56:32 +00:00
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Reference to the Controller for this view.
|
2005-09-17 07:56:32 +00:00
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @var Controller
|
2005-09-17 07:56:32 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
var $controller = null;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2005-12-28 17:23:12 +00:00
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Array of loaded view helpers.
|
2005-12-28 17:23:12 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
var $loaded = array();
|
|
|
|
|
2006-01-01 02:05:01 +00:00
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* File extension. Defaults to Cake's conventional ".thtml".
|
2006-01-01 02:05:01 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
var $ext = '.thtml';
|
|
|
|
|
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Sub-directory for this view file.
|
2006-01-01 02:05:01 +00:00
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @var string
|
2006-01-01 02:05:01 +00:00
|
|
|
*/
|
|
|
|
var $subDir = null;
|
|
|
|
|
2006-02-01 13:26:23 +00:00
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Enter description here... Themes. New in Cake RC4.
|
2006-02-01 13:26:23 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
var $themeWeb = null;
|
|
|
|
|
|
|
|
/**
|
2006-02-07 02:19:53 +00:00
|
|
|
* Plugin name. A Plugin is a sub-application. New in Cake RC4.
|
2006-02-01 13:26:23 +00:00
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @link http://wiki.cakephp.org/docs:plugins
|
|
|
|
* @var string
|
2006-02-01 13:26:23 +00:00
|
|
|
*/
|
|
|
|
var $plugin = null;
|
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
/**
|
2005-08-25 16:40:50 +00:00
|
|
|
* Constructor
|
2005-07-21 04:02:32 +00:00
|
|
|
*
|
|
|
|
* @return View
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function __construct (&$controller)
|
|
|
|
{
|
2005-09-17 07:56:32 +00:00
|
|
|
$this->controller =& $controller;
|
|
|
|
$this->_viewVars =& $this->controller->_viewVars;
|
|
|
|
$this->action =& $this->controller->action;
|
|
|
|
$this->autoLayout =& $this->controller->autoLayout;
|
|
|
|
$this->autoRender =& $this->controller->autoRender;
|
|
|
|
$this->base =& $this->controller->base;
|
2005-10-03 04:48:00 +00:00
|
|
|
$this->webroot =& $this->controller->webroot;
|
2005-09-17 07:56:32 +00:00
|
|
|
$this->helpers =& $this->controller->helpers;
|
|
|
|
$this->here =& $this->controller->here;
|
|
|
|
$this->layout =& $this->controller->layout;
|
[1178]
Author: phpnut
Date: 8:52:12 PM, Sunday, October 23, 2005
Message:
adding cakephp power image
[1177]
Author: phpnut
Date: 8:48:32 PM, Sunday, October 23, 2005
Message:
Updated scaffold to use new layout template.
[1176]
Author: phpnut
Date: 7:09:27 PM, Sunday, October 23, 2005
Message:
renaming cake/conf to cake/config
[1175]
Author: phpnut
Date: 7:06:04 PM, Sunday, October 23, 2005
Message:
moving tags.ini.php to cake/conf/tags.ini.php
[1174]
Author: phpnut
Date: 6:52:19 PM, Sunday, October 23, 2005
Message:
updating css/cake.scaffold.css
[1173]
Author: phpnut
Date: 6:46:07 PM, Sunday, October 23, 2005
Message:
updating css/cake.deafult.css and default layout
[1172]
Author: phpnut
Date: 6:42:48 PM, Sunday, October 23, 2005
Message:
updating css/cake.scaffold.css
[1171]
Author: phpnut
Date: 6:41:00 PM, Sunday, October 23, 2005
Message:
Adding spaces to tags.ini file
[1170]
Author: phpnut
Date: 6:37:17 PM, Sunday, October 23, 2005
Message:
Removing code that is no longer used
[1169]
Author: phpnut
Date: 6:34:24 PM, Sunday, October 23, 2005
Message:
removing files that are no longer used
[1168]
Author: phpnut
Date: 6:19:46 PM, Sunday, October 23, 2005
Message:
Cleaning up Scaffold class.
[1167]
Author: phpnut
Date: 5:26:27 PM, Sunday, October 23, 2005
Message:
Changes are added to remove the $this->models array that would hold the instance of the models.
Now they are available as $this->ModelName; This should be CamelCased.
Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted.
[1166]
Author: phpnut
Date: 3:53:08 PM, Sunday, October 23, 2005
Message:
Making change to allow setting the name of a class camel cased to fix issues with PHP 4.
In both the model and the controllers:
Model: var $name = 'ModelName';
Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController.
[1165]
Author: phpnut
Date: 1:45:17 PM, Sunday, October 23, 2005
Message:
Fix added for problems with key name that was added to the class registry when underscored
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
|
|
|
$this->modelNames =& $this->controller->modelNames;
|
2005-09-17 07:56:32 +00:00
|
|
|
$this->name =& $this->controller->name;
|
|
|
|
$this->pageTitle =& $this->controller->pageTitle;
|
|
|
|
$this->parent =& $this->controller->parent;
|
|
|
|
$this->viewPath =& $this->controller->viewPath;
|
|
|
|
$this->params =& $this->controller->params;
|
|
|
|
$this->data =& $this->controller->data;
|
|
|
|
$this->displayFields =& $this->controller->displayFields;
|
2005-12-22 01:07:28 +00:00
|
|
|
$this->webservices =& $this->controller->webservices;
|
2006-02-01 13:26:23 +00:00
|
|
|
$this->plugin =& $this->controller->plugin;
|
2005-12-28 17:23:12 +00:00
|
|
|
parent::__construct();
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-12-22 01:07:28 +00:00
|
|
|
* Renders view for given action and layout. If $file is given, that is used
|
2005-07-10 05:08:19 +00:00
|
|
|
* for a view filename (e.g. customFunkyView.thtml).
|
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param string $action Name of action to render for
|
|
|
|
* @param string $layout Layout to use
|
|
|
|
* @param string $file Custom filename for view
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function render($action=null, $layout=null, $file=null)
|
|
|
|
{
|
|
|
|
if (isset($this->hasRendered) && $this->hasRendered)
|
2005-07-10 05:08:19 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->hasRendered = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$action)
|
|
|
|
{
|
|
|
|
$action = $this->action;
|
|
|
|
}
|
|
|
|
if ($layout)
|
|
|
|
{
|
|
|
|
$this->setLayout($layout);
|
|
|
|
}
|
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
if ($file)
|
|
|
|
{
|
|
|
|
$viewFileName = $file;
|
|
|
|
}
|
2005-12-28 17:23:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$viewFileName = $this->_getViewFileName($action);
|
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2006-02-01 13:26:23 +00:00
|
|
|
if(!is_null($this->plugin) && is_null($file))
|
|
|
|
{
|
|
|
|
return $this->pluginView($action, $layout);
|
|
|
|
}
|
|
|
|
|
2006-02-16 09:29:28 +00:00
|
|
|
if (!is_file($viewFileName) && !$viewFileName = fileExistsInPath($viewFileName))
|
2005-07-10 05:08:19 +00:00
|
|
|
{
|
|
|
|
if (strtolower(get_class($this)) == 'template')
|
|
|
|
{
|
|
|
|
return array('action' => $action, 'layout' => $layout, 'viewFn' => $viewFileName);
|
|
|
|
}
|
|
|
|
|
2006-02-18 23:42:21 +00:00
|
|
|
// check to see if the missing view is due to a custom missingAction
|
2005-07-10 05:08:19 +00:00
|
|
|
if (strpos($action, 'missingAction') !== false)
|
|
|
|
{
|
|
|
|
$errorAction = 'missingAction';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$errorAction = 'missingView';
|
|
|
|
}
|
|
|
|
|
2006-02-18 23:42:21 +00:00
|
|
|
// check for controller-level view handler
|
2005-07-10 05:08:19 +00:00
|
|
|
foreach(array($this->name, 'errors') as $viewDir)
|
|
|
|
{
|
[1198]
Author: phpnut
Date: 7:29:04 PM, Monday, October 24, 2005
Message:
More work on changes to use CamelCase throughout the system.
[1197]
Author: phpnut
Date: 2:57:08 PM, Monday, October 24, 2005
Message:
Removing unneeded calls to Inflector class
[1196]
Author: phpnut
Date: 2:39:30 PM, Monday, October 24, 2005
Message:
adding fix for Ticket #61
[1195]
Author: phpnut
Date: 11:19:43 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #47
[1194]
Author: phpnut
Date: 10:10:41 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #49
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-25 00:33:08 +00:00
|
|
|
$errorAction =Inflector::underscore($errorAction);
|
2006-01-01 02:05:01 +00:00
|
|
|
if(file_exists(VIEWS.$viewDir.DS.$errorAction.$this->ext))
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
2006-01-01 02:05:01 +00:00
|
|
|
$missingViewFileName = VIEWS.$viewDir.DS.$errorAction.$this->ext;
|
2005-10-03 04:48:00 +00:00
|
|
|
}
|
2006-02-16 09:29:28 +00:00
|
|
|
elseif($missingViewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml'))
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$missingViewFileName = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
$missingViewExists = is_file($missingViewFileName);
|
|
|
|
if ($missingViewExists)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
break;
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strpos($action, 'missingView') === false)
|
|
|
|
{
|
2006-01-13 23:53:23 +00:00
|
|
|
return $this->cakeError('missingView',
|
|
|
|
array(array('className' => $this->controller->name,
|
|
|
|
'action' => $action,
|
|
|
|
'file' => $viewFileName)));
|
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
$isFatal = isset($this->isFatal) ? $this->isFatal : false;
|
|
|
|
if (!$isFatal)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$viewFileName = $missingViewFileName;
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$missingViewExists = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$missingViewExists || $isFatal)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
// app/view/errors/missing_view.thtml view is missing!
|
2005-07-10 05:08:19 +00:00
|
|
|
if (DEBUG)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
trigger_error(sprintf(__("No template file for view %s (expected %s), create it first'"), $action, $viewFileName), E_USER_ERROR);
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$this->error('404', 'Not found', sprintf("The requested address %s was not found on this server.", '', "missing view \"{$action}\""));
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($viewFileName && !$this->hasRendered)
|
|
|
|
{
|
2006-01-01 02:05:01 +00:00
|
|
|
if(substr($viewFileName, -5) === 'thtml')
|
|
|
|
{
|
|
|
|
$out = View::_render($viewFileName, $this->_viewVars, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$out = $this->_render($viewFileName, $this->_viewVars, 0);
|
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
if ($out !== false)
|
|
|
|
{
|
|
|
|
if ($this->layout && $this->autoLayout)
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$out = $this->renderLayout($out);
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print $out;
|
|
|
|
$this->hasRendered = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$out = $this->_render($viewFileName, $this->_viewVars, false);
|
2006-01-12 02:10:47 +00:00
|
|
|
trigger_error(sprintf(__("Error in view %s, got: <blockquote>%s</blockquote>"), $viewFileName, $out), E_USER_ERROR);
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.
|
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* This realizes the concept of Elements, (or "partial layouts")
|
2005-12-22 01:07:28 +00:00
|
|
|
* and the $params array is used to send data to be used in the
|
2005-08-25 16:40:50 +00:00
|
|
|
* Element.
|
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @link http://wiki.cakephp.org/docs:view:renderelement
|
2006-02-18 23:42:21 +00:00
|
|
|
* @param string $name Name of template file in the/app/views/elements/ folder
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param array $params Array of data to be made available to the for rendered view (i.e. the Element)
|
|
|
|
* @return string Rendered output
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function renderElement($name, $params=array())
|
|
|
|
{
|
2006-01-01 02:05:01 +00:00
|
|
|
$fn = ELEMENTS.$name.$this->ext;
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2006-02-03 06:06:15 +00:00
|
|
|
if(!is_null($this->plugin))
|
|
|
|
{
|
|
|
|
if(file_exists(APP.'plugins'.DS.$this->plugin.'views'.DS.'elements'.DS.$name.$this->ext))
|
|
|
|
{
|
|
|
|
$fn = APP.'plugins'.DS.$this->plugin.'views'.DS.'elements'.DS.$name.$this->ext;
|
|
|
|
$params = array_merge_recursive($params, $this->loaded);
|
|
|
|
return $this->_render($fn, array_merge($this->_viewVars, $params), true, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
if (!file_exists($fn))
|
|
|
|
{
|
|
|
|
return "(Error rendering {$name})";
|
|
|
|
}
|
2006-02-03 06:06:15 +00:00
|
|
|
|
2005-12-28 17:23:12 +00:00
|
|
|
$params = array_merge_recursive($params, $this->loaded);
|
2005-12-27 03:33:44 +00:00
|
|
|
return $this->_render($fn, array_merge($this->_viewVars, $params), true, false);
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a layout. Returns output from _render(). Returns false on error.
|
|
|
|
*
|
2005-08-25 16:40:50 +00:00
|
|
|
* @param string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
|
2005-10-18 22:27:39 +00:00
|
|
|
* @return mixed Rendered output, or false on error
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function renderLayout($content_for_layout)
|
|
|
|
{
|
2005-07-10 05:08:19 +00:00
|
|
|
$layout_fn = $this->_getLayoutFileName();
|
|
|
|
|
2006-01-13 05:56:04 +00:00
|
|
|
if(DEBUG > 2)
|
|
|
|
{
|
|
|
|
$debug = View::_render(LIBS.'view'.DS.'templates'.DS.'elements'.DS.'dump.thtml', array('controller' => $this->controller), true, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$debug = '';
|
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
$data_for_layout = array_merge($this->_viewVars, array(
|
|
|
|
'title_for_layout'=>$this->pageTitle !== false? $this->pageTitle: Inflector::humanize($this->viewPath),
|
2006-01-13 05:56:04 +00:00
|
|
|
'content_for_layout'=>$content_for_layout,
|
|
|
|
'cakeDebug' => $debug));
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
if (is_file($layout_fn))
|
|
|
|
{
|
2005-12-28 17:23:12 +00:00
|
|
|
$data_for_layout = array_merge($data_for_layout,$this->loaded); # load all view variables)
|
2006-01-01 02:05:01 +00:00
|
|
|
|
|
|
|
if(substr($layout_fn, -5) === 'thtml')
|
|
|
|
{
|
|
|
|
$out = View::_render($layout_fn, $data_for_layout, true, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$out = $this->_render($layout_fn, $data_for_layout, true, false);
|
|
|
|
}
|
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
if ($out === false)
|
|
|
|
{
|
|
|
|
$out = $this->_render($layout_fn, $data_for_layout, false);
|
2006-01-12 02:10:47 +00:00
|
|
|
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>"), $layout_fn, $out), E_USER_ERROR);
|
2005-07-10 05:08:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-13 23:53:23 +00:00
|
|
|
return $this->cakeError('missingLayout',
|
|
|
|
array(array('layout' => $this->layout,
|
|
|
|
'file' => $layout_fn)));
|
2005-07-10 05:08:19 +00:00
|
|
|
}
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
2005-10-18 22:27:39 +00:00
|
|
|
* Sets layout to be used when rendering.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param string $layout Name of layout.
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function setLayout($layout)
|
|
|
|
{
|
2005-07-10 05:08:19 +00:00
|
|
|
$this->layout = $layout;
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays an error page to the user. Uses layouts/error.html to render the page.
|
|
|
|
*
|
2006-02-07 02:19:53 +00:00
|
|
|
* @param int $code HTTP Error code (for instance: 404)
|
|
|
|
* @param string $name Name of the error (for instance: Not Found)
|
|
|
|
* @param string $message Error message as a web page
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function error ($code, $name, $message)
|
|
|
|
{
|
2005-07-10 05:08:19 +00:00
|
|
|
header ("HTTP/1.0 {$code} {$name}");
|
|
|
|
print ($this->_render(VIEWS.'layouts/error.thtml', array('code'=>$code,'name'=>$name,'message'=>$message)));
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
2006-02-18 23:42:21 +00:00
|
|
|
* Private methods.
|
|
|
|
*************************************************************************/
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param string $action Controller action to find template filename for
|
|
|
|
* @return string Template filename
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function _getViewFileName($action)
|
|
|
|
{
|
|
|
|
$action = Inflector::underscore($action);
|
|
|
|
|
|
|
|
if(!is_null($this->webservices))
|
|
|
|
{
|
|
|
|
$type = strtolower($this->webservices).DS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$type = null;
|
|
|
|
}
|
|
|
|
$viewFileName = VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext;
|
|
|
|
|
|
|
|
if(file_exists(VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext))
|
|
|
|
{
|
|
|
|
$viewFileName = VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext;
|
|
|
|
}
|
|
|
|
elseif(file_exists(VIEWS.'errors'.DS.$this->subDir.$type.$action.$this->ext))
|
|
|
|
{
|
|
|
|
$viewFileName = VIEWS.'errors'.DS.$this->subDir.$type.$action.$this->ext;
|
|
|
|
}
|
|
|
|
elseif($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
elseif($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.$this->viewPath.DS.$type.$action.'.thtml'))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$viewPath = explode(DS, $viewFileName);
|
|
|
|
$i = array_search('..', $viewPath);
|
|
|
|
unset($viewPath[$i-1]);
|
|
|
|
unset($viewPath[$i]);
|
|
|
|
$return = '/'.implode('/', $viewPath);
|
|
|
|
return $return;
|
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns layout filename for this template as a string.
|
|
|
|
*
|
|
|
|
* @return string Filename for layout file (.thtml).
|
|
|
|
* @access private
|
|
|
|
*/
|
2005-12-22 01:07:28 +00:00
|
|
|
function _getLayoutFileName()
|
|
|
|
{
|
|
|
|
if(!is_null($this->webservices))
|
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
$type = strtolower($this->webservices).DS;
|
2005-12-22 01:07:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$type = null;
|
|
|
|
}
|
2006-02-03 06:06:15 +00:00
|
|
|
|
|
|
|
if(!is_null($this->plugin))
|
|
|
|
{
|
|
|
|
if(file_exists(APP.'plugins'.DS.$this->plugin.'views'.DS.'layouts'.DS.$this->layout.$this->ext))
|
|
|
|
{
|
|
|
|
$layoutFileName = APP.'plugins'.DS.$this->plugin.'views'.DS.'layouts'.DS.$this->layout.$this->ext;
|
|
|
|
return $layoutFileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-01 02:05:01 +00:00
|
|
|
$layoutFileName = LAYOUTS.$type."{$this->layout}$this->ext";
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2006-01-01 02:05:01 +00:00
|
|
|
if(file_exists(LAYOUTS.$this->subDir.$type."{$this->layout}$this->ext"))
|
2005-12-27 03:33:44 +00:00
|
|
|
{
|
2006-01-01 02:05:01 +00:00
|
|
|
$layoutFileName = LAYOUTS.$this->subDir.$type."{$this->layout}$this->ext";
|
2005-12-27 03:33:44 +00:00
|
|
|
}
|
2006-02-16 09:29:28 +00:00
|
|
|
elseif($layoutFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS."layouts".DS.$type."{$this->layout}.thtml"))
|
2005-12-27 03:33:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
return $layoutFileName;
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
/**
|
2005-12-22 01:07:28 +00:00
|
|
|
* Renders and returns output for given view filename with its
|
2005-07-10 05:08:19 +00:00
|
|
|
* array of data.
|
|
|
|
*
|
|
|
|
* @param string $___viewFn Filename of the view
|
2006-02-18 23:42:21 +00:00
|
|
|
* @param array $___dataForView Data to include in rendered view
|
|
|
|
* @param boolean $___playSafe If set to false, the include() of the $__viewFn is done without suppressing output of errors
|
2005-07-10 05:08:19 +00:00
|
|
|
* @return string Rendered output
|
|
|
|
* @access private
|
|
|
|
*/
|
2006-02-18 23:42:21 +00:00
|
|
|
function _render($___viewFn, $___dataForView, $___playSafe = true, $loadHelpers = true)
|
2005-12-28 17:23:12 +00:00
|
|
|
{
|
|
|
|
if ($this->helpers != false && $loadHelpers === true)
|
|
|
|
{
|
|
|
|
$loadedHelpers = array();
|
|
|
|
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-12-28 17:23:12 +00:00
|
|
|
foreach(array_keys($loadedHelpers) as $helper)
|
|
|
|
{
|
|
|
|
$replace = strtolower(substr($helper, 0, 1));
|
|
|
|
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
|
2005-12-28 01:52:56 +00:00
|
|
|
|
2005-12-28 17:23:12 +00:00
|
|
|
${$camelBackedHelper} =& $loadedHelpers[$helper];
|
|
|
|
|
|
|
|
if(isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
|
|
|
|
{
|
|
|
|
foreach(${$camelBackedHelper}->helpers as $subHelper)
|
|
|
|
{
|
|
|
|
${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->loaded[$camelBackedHelper] = (${$camelBackedHelper});
|
|
|
|
}
|
|
|
|
}
|
2005-07-10 05:08:19 +00:00
|
|
|
|
2006-02-18 23:42:21 +00:00
|
|
|
extract($___dataForView, EXTR_SKIP); # load all view variables
|
2005-12-27 03:33:44 +00:00
|
|
|
/**
|
2006-02-18 23:42:21 +00:00
|
|
|
* Local template variables.
|
|
|
|
*/
|
|
|
|
$BASE = $this->base;
|
2005-07-10 05:08:19 +00:00
|
|
|
$params = &$this->params;
|
|
|
|
$page_title = $this->pageTitle;
|
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
/**
|
2006-02-18 23:42:21 +00:00
|
|
|
* Start caching output (eval outputs directly so we need to cache).
|
|
|
|
*/
|
2005-07-10 05:08:19 +00:00
|
|
|
ob_start();
|
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
/**
|
2006-02-18 23:42:21 +00:00
|
|
|
* Include the template.
|
|
|
|
*/
|
|
|
|
$___playSafe? @include($___viewFn): include($___viewFn);
|
2005-07-10 05:08:19 +00:00
|
|
|
|
|
|
|
$out = ob_get_clean();
|
|
|
|
|
|
|
|
return $out;
|
2006-02-18 23:42:21 +00:00
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
/**
|
2006-02-18 23:42:21 +00:00
|
|
|
* Loads helpers, with their dependencies.
|
|
|
|
*
|
|
|
|
* @param array $loaded List of helpers that are already loaded.
|
|
|
|
* @param array $helpers List of helpers to load.
|
|
|
|
* @return array
|
2005-10-09 01:56:21 +00:00
|
|
|
*/
|
2005-12-27 03:33:44 +00:00
|
|
|
function &_loadHelpers(&$loaded, $helpers)
|
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
static $tags;
|
|
|
|
if(empty($tags))
|
|
|
|
{
|
|
|
|
$helperTags = new Helper();
|
|
|
|
$tags = $helperTags->loadConfig();
|
|
|
|
}
|
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
foreach ($helpers as $helper)
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
2005-12-27 03:33:44 +00:00
|
|
|
$helperCn = $helper.'Helper';
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
if(in_array($helper, array_keys($loaded)) !== true)
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
2005-12-27 03:33:44 +00:00
|
|
|
if(!class_exists($helperCn))
|
|
|
|
{
|
|
|
|
$helperFn = Inflector::underscore($helper).'.php';
|
2006-02-01 13:26:23 +00:00
|
|
|
|
|
|
|
if(file_exists(APP.'plugins'.DS.$this->plugin.'views'.DS.'helpers'.DS.$helperFn))
|
|
|
|
{
|
|
|
|
$helperFn = APP.'plugins'.DS.$this->plugin.'views'.DS.'helpers'.DS.$helperFn;
|
|
|
|
}
|
|
|
|
else if(file_exists(HELPERS.$helperFn))
|
2005-12-27 03:33:44 +00:00
|
|
|
{
|
|
|
|
$helperFn = HELPERS.$helperFn;
|
|
|
|
}
|
2006-02-16 09:29:28 +00:00
|
|
|
else if($helperFn = fileExistsInPath(LIBS.'view'.DS.'helpers'.DS.$helperFn))
|
2005-12-27 03:33:44 +00:00
|
|
|
{
|
2006-02-16 09:29:28 +00:00
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
}
|
|
|
|
if (is_file($helperFn))
|
|
|
|
{
|
2006-02-17 10:12:15 +00:00
|
|
|
require $helperFn;
|
2005-12-27 03:33:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-13 23:53:23 +00:00
|
|
|
return $this->cakeError('missingHelperFile',
|
|
|
|
array(array('helper' => $helper,
|
|
|
|
'file' => Inflector::underscore($helper).'.php')));
|
2005-12-27 03:33:44 +00:00
|
|
|
}
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
|
2005-12-27 03:33:44 +00:00
|
|
|
$replace = strtolower(substr($helper, 0, 1));
|
|
|
|
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
|
[1210]
Author: phpnut
Date: 4:44:45 AM, Wednesday, October 26, 2005
Message:
AJAX is now available as a by default in the $html variable in the templates.
You access it like this:
$html->Ajax->xxx();
Updated default templates.
[1208]
Author: phpnut
Date: 6:49:26 PM, Tuesday, October 25, 2005
Message:
Adding fix in Controller::generateFieldNames();
[1203]
Author: phpnut
Date: 10:40:28 AM, Tuesday, October 25, 2005
Message:
Changes made to core templates and css.
Fixed added for Ticket #60
[1202]
Author: phpnut
Date: 2:30:58 AM, Tuesday, October 25, 2005
Message:
Fix for cake error templates
Fixed a key for tables that are underscored in scaffolded code.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1211 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-26 10:55:44 +00:00
|
|
|
|
2005-12-27 17:14:32 +00:00
|
|
|
if(class_exists($helperCn))
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
2006-02-18 23:42:21 +00:00
|
|
|
${$camelBackedHelper} =& new $helperCn;
|
2005-12-27 03:33:44 +00:00
|
|
|
${$camelBackedHelper}->base = $this->base;
|
|
|
|
${$camelBackedHelper}->webroot = $this->webroot;
|
|
|
|
${$camelBackedHelper}->here = $this->here;
|
2006-02-18 23:42:21 +00:00
|
|
|
${$camelBackedHelper}->params = $this->params;
|
|
|
|
${$camelBackedHelper}->action = $this->action;
|
2005-12-27 03:33:44 +00:00
|
|
|
${$camelBackedHelper}->data = $this->data;
|
2006-02-01 13:26:23 +00:00
|
|
|
${$camelBackedHelper}->themeWeb = $this->themeWeb;
|
2005-12-28 17:23:12 +00:00
|
|
|
${$camelBackedHelper}->tags = $tags;
|
2005-12-27 03:33:44 +00:00
|
|
|
|
|
|
|
if(!empty($this->validationErrors))
|
|
|
|
{
|
|
|
|
${$camelBackedHelper}->validationErrors = $this->validationErrors;
|
|
|
|
}
|
|
|
|
$loaded[$helper] =& ${$camelBackedHelper};
|
|
|
|
if (isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
|
|
|
|
{
|
|
|
|
$loaded =& $this->_loadHelpers($loaded, ${$camelBackedHelper}->helpers);
|
|
|
|
}
|
2005-10-03 04:48:00 +00:00
|
|
|
}
|
2005-12-27 03:33:44 +00:00
|
|
|
else
|
2005-10-03 04:48:00 +00:00
|
|
|
{
|
2006-01-13 23:53:23 +00:00
|
|
|
return $this->cakeError('missingHelperClass',
|
|
|
|
array(array('helper' => $helper,
|
|
|
|
'file' => Inflector::underscore($helper).'.php')));
|
2005-10-03 04:48:00 +00:00
|
|
|
}
|
2005-12-27 03:33:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $loaded;
|
|
|
|
}
|
2005-06-21 23:44:49 +00:00
|
|
|
|
2006-02-01 13:26:23 +00:00
|
|
|
function pluginView($action, $layout)
|
|
|
|
{
|
|
|
|
$viewFileName = APP.'plugins'.DS.$this->plugin.'views'.DS.$this->viewPath.DS.$action.$this->ext;
|
|
|
|
if(file_exists($viewFileName))
|
|
|
|
{
|
|
|
|
$this->render($action, $layout, $viewFileName);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $this->cakeError('missingView',
|
|
|
|
array(array('className' => $this->controller->name,
|
|
|
|
'action' => $action,
|
|
|
|
'file' => $viewFileName)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-06-21 23:44:49 +00:00
|
|
|
?>
|