mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add ::before()
This commit is contained in:
parent
2a64bdb1fc
commit
97e891895a
@ -88,6 +88,8 @@ class Template extends Render {
|
|||||||
*/
|
*/
|
||||||
private $_ignore = false;
|
private $_ignore = false;
|
||||||
|
|
||||||
|
private $_before;
|
||||||
|
|
||||||
private $_filter = array();
|
private $_filter = array();
|
||||||
|
|
||||||
private static $_checkers = array(
|
private static $_checkers = array(
|
||||||
@ -259,6 +261,14 @@ class Template extends Render {
|
|||||||
$this->addDepend($this); // for 'verify' performance
|
$this->addDepend($this); // for 'verify' performance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute some code in loading cache
|
||||||
|
* @param $code
|
||||||
|
*/
|
||||||
|
public function before($code) {
|
||||||
|
$this->_before .= $code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate temporary internal template variable
|
* Generate temporary internal template variable
|
||||||
* @return string
|
* @return string
|
||||||
@ -354,6 +364,7 @@ class Template extends Render {
|
|||||||
public function getTemplateCode() {
|
public function getTemplateCode() {
|
||||||
return "<?php \n".
|
return "<?php \n".
|
||||||
"/** Fenom template '".$this->_name."' compiled at ".date('Y-m-d H:i:s')." */\n".
|
"/** Fenom template '".$this->_name."' compiled at ".date('Y-m-d H:i:s')." */\n".
|
||||||
|
($this->_before ? $this->_before."\n" : "").
|
||||||
"return new Fenom\\Render(\$fenom, ".$this->_getClosureSource().", ".var_export(array(
|
"return new Fenom\\Render(\$fenom, ".$this->_getClosureSource().", ".var_export(array(
|
||||||
"options" => $this->_options,
|
"options" => $this->_options,
|
||||||
"provider" => $this->_scm,
|
"provider" => $this->_scm,
|
||||||
|
Loading…
Reference in New Issue
Block a user