From 6d2a73577741d7d74c65132177dd0f7ce2030d53 Mon Sep 17 00:00:00 2001 From: Thomas Hunziker Date: Sun, 2 Oct 2011 20:00:00 +0300 Subject: [PATCH 1/2] Only setting the viewLayout if a layout is passed in the request. The default value should not be set here as it already has been set by the JView constructor, allowing for a view to have a different default value than 'default'. --- libraries/joomla/application/component/controller.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/joomla/application/component/controller.php b/libraries/joomla/application/component/controller.php index 269f5b220e..eea09cb0f1 100644 --- a/libraries/joomla/application/component/controller.php +++ b/libraries/joomla/application/component/controller.php @@ -660,7 +660,7 @@ public function display($cachable = false, $urlparams = false) $document = JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view', $this->default_view); - $viewLayout = JRequest::getCmd('layout', 'default'); + $viewLayout = JRequest::getCmd('layout', ''); $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath)); @@ -672,7 +672,10 @@ public function display($cachable = false, $urlparams = false) } // Set the layout - $view->setLayout($viewLayout); + if ($viewLayout) + { + $view->setLayout($viewLayout); + } $view->assignRef('document', $document); From 19d728a1faa106e1b0026c874cb292999716c187 Mon Sep 17 00:00:00 2001 From: Thomas Hunziker Date: Fri, 14 Oct 2011 13:08:04 +0300 Subject: [PATCH 2/2] Making the improvements suggested by Hackwar --- libraries/joomla/application/component/controller.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libraries/joomla/application/component/controller.php b/libraries/joomla/application/component/controller.php index eea09cb0f1..8177b6324a 100644 --- a/libraries/joomla/application/component/controller.php +++ b/libraries/joomla/application/component/controller.php @@ -660,9 +660,9 @@ public function display($cachable = false, $urlparams = false) $document = JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view', $this->default_view); - $viewLayout = JRequest::getCmd('layout', ''); + $viewLayout = JRequest::getCmd('layout', 'default'); - $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath)); + $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout)); // Get/Create the model if ($model = $this->getModel($viewName)) @@ -671,12 +671,6 @@ public function display($cachable = false, $urlparams = false) $view->setModel($model, true); } - // Set the layout - if ($viewLayout) - { - $view->setLayout($viewLayout); - } - $view->assignRef('document', $document); $conf = JFactory::getConfig();