Adds folder support for making partials

This commit is contained in:
Samuel Georges 2015-04-14 22:17:10 +10:00
parent cf1988eeca
commit 8e69039c0d
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@
use File;
use Twig_Error;
use Cms\Classes\SectionParser;
use ApplicationException;
use October\Rain\Exception\ApplicationException;
use Exception;
/**

View File

@ -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);