Skip to content

Commit

Permalink
Ability to customise View partial separator
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksleight committed Jul 6, 2015
1 parent 9a4626a commit 16c2636
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class View implements \Coast\App\Access, \Coast\App\Executable

protected $_extName = 'php';

protected $_partialSeparator = '_';

protected $_contexts = [];

protected $_active;
Expand Down Expand Up @@ -72,6 +74,15 @@ public function extName($extName = null)
return $this->_extName;
}

public function partialSeparator($partialSeparator = null)
{
if (func_num_args() > 0) {
$this->_partialSeparator = $partialSeparator;
return $this;
}
return $this->_partialSeparator;
}

protected function _meta($group, Dir $dir)
{
$meta = $dir->file('_.php');
Expand Down Expand Up @@ -226,10 +237,10 @@ protected function _run(File $__file, array $__params = array())
return $this->end();
}

public function partial($path)
public function partial($name)
{
array_unshift($this->_active->renders, (object) [
'script' => $this->script("{$this->_active->script->path}/{$path}"),
'script' => $this->script("{$this->_active->script->path}{$this->_partialSeparator}{$name}"),
'depth' => 0,
]);
$content = $this->_render();
Expand Down

0 comments on commit 16c2636

Please sign in to comment.