Skip to content

Commit

Permalink
change template could assign header
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Sep 16, 2017
1 parent 33257c0 commit 6b48eb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class Template
function __construct($folder){
$configFile = $folder.'/config/config.php';
if(p\realpath($configFile)){
$r=p\l($configFile,_INIT_CONFIG);
$r=p\l(
$configFile,
_INIT_CONFIG
);
$this->_configs =& $r->var[_INIT_CONFIG];
} else {
return !trigger_error('Can\'t find theme config file ('.$configFile.')');
Expand Down Expand Up @@ -54,5 +57,3 @@ function getFile($tpl_name, $useDefault = true){
}

} //end class Template


14 changes: 8 additions & 6 deletions src/ViewEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function setThemeFolder($val)
if (!$this['themeFolder']) {
throw new DomainException('Template folder was not found: ['.$val.']');
}
$this->initTemplateHelper();
}

/**
Expand Down Expand Up @@ -139,13 +140,14 @@ public function getTpl()
*/
public function initTemplateHelper($tpl=null)
{
if (!$this->_tpl) {
if (is_null($tpl)) {
$tpl = new Template($this['themeFolder']);
}
$this->_tpl = $tpl;
$this[[]] = $tpl(); //append
if (!empty($this->_tpl)) {
return;
}
if (is_null($tpl)) {
$tpl = new Template($this['themeFolder']);
}
$this->_tpl = $tpl;
$this[[]] = $tpl(); //append

/**
* Copy tpl variables back to plugin config
Expand Down

0 comments on commit 6b48eb7

Please sign in to comment.