From 3229567cbd603210c9e0bc44ed0b023adb72a2fb Mon Sep 17 00:00:00 2001 From: phpnut Date: Fri, 3 Feb 2006 06:06:15 +0000 Subject: [PATCH] Merging fixes and enhancements into trunk Revision: [1917] Adding fix to pass args when using plugins. Adding fix to allow plugin elements to be rendered properly Revision: [1916] Adding plugin layouts to search path if a plugin is being accessed. If no layout is found then the app/views/layouts/*.thtml will be used. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1918 3807eeeb-6ff5-0310-8944-8be069107fe0 --- VERSION.txt | 2 +- cake/dispatcher.php | 1 + cake/libs/view/view.php | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index c6c495eba..d02690475 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.8.1915 RC 4 \ No newline at end of file +0.10.8.1918 RC 4 \ No newline at end of file diff --git a/cake/dispatcher.php b/cake/dispatcher.php index dc3e7153a..a9e4d6ab9 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -407,6 +407,7 @@ class Dispatcher extends Object if(isset($params['pass'][0])) { $params['action'] = $params['pass'][0]; + array_shift($params['pass']); } else { diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 14877d9d3..ae81a2ff6 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -401,10 +401,21 @@ class View extends Object { $fn = ELEMENTS.$name.$this->ext; + 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); + } + } + if (!file_exists($fn)) { return "(Error rendering {$name})"; } + $params = array_merge_recursive($params, $this->loaded); return $this->_render($fn, array_merge($this->_viewVars, $params), true, false); } @@ -556,6 +567,16 @@ class View extends Object { $type = null; } + + 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; + } + } + $layoutFileName = LAYOUTS.$type."{$this->layout}$this->ext"; if(file_exists(LAYOUTS.$this->subDir.$type."{$this->layout}$this->ext"))