From 8e69039c0da044b4a64a22543354e3fd2020ab7c Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Tue, 14 Apr 2015 22:17:10 +1000 Subject: [PATCH] Adds folder support for making partials --- modules/cms/classes/CmsException.php | 2 +- modules/system/traits/ViewMaker.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/cms/classes/CmsException.php b/modules/cms/classes/CmsException.php index e5d9b6853..82b47e9e4 100644 --- a/modules/cms/classes/CmsException.php +++ b/modules/cms/classes/CmsException.php @@ -3,7 +3,7 @@ use File; use Twig_Error; use Cms\Classes\SectionParser; -use ApplicationException; +use October\Rain\Exception\ApplicationException; use Exception; /** diff --git a/modules/system/traits/ViewMaker.php b/modules/system/traits/ViewMaker.php index c7d409820..830f970a5 100644 --- a/modules/system/traits/ViewMaker.php +++ b/modules/system/traits/ViewMaker.php @@ -50,7 +50,8 @@ trait ViewMaker public function makePartial($partial, $params = [], $throwException = true) { if (!File::isPathSymbol($partial) && realpath($partial) === false) { - $partial = '_' . strtolower($partial) . '.htm'; + $folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : ''; + $partial = $folder . '_' . strtolower(basename($partial)).'.htm'; } $partialPath = $this->getViewPath($partial); @@ -136,7 +137,8 @@ trait ViewMaker public function makeLayoutPartial($partial, $params = []) { if (!File::isLocalPath($partial) && !File::isPathSymbol($partial)) { - $partial = '_' . strtolower($partial); + $folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : ''; + $partial = $folder . '_' . strtolower(basename($partial)); } return $this->makeLayout($partial, $params);