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 $_before;
|
||||
|
||||
private $_filter = array();
|
||||
|
||||
private static $_checkers = array(
|
||||
@ -259,6 +261,14 @@ class Template extends Render {
|
||||
$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
|
||||
* @return string
|
||||
@ -354,6 +364,7 @@ class Template extends Render {
|
||||
public function getTemplateCode() {
|
||||
return "<?php \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(
|
||||
"options" => $this->_options,
|
||||
"provider" => $this->_scm,
|
||||
|
Loading…
Reference in New Issue
Block a user