[limb-svn] r6823 - 3.x/trunk/limb/macro/src
svn at limb-project.com
svn at limb-project.com
Wed Mar 5 12:31:34 MSK 2008
Author: serega
Date: 2008-03-05 12:31:33 +0300 (Wed, 05 Mar 2008)
New Revision: 6823
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6823
Modified:
3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php
Log:
-- lmbMacroTemplate :: compile() method added that return an array of two elements: compiled file path and generated php class name
Modified: 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php 2008-03-05 09:24:59 UTC (rev 6822)
+++ 3.x/trunk/limb/macro/src/lmbMacroTemplate.class.php 2008-03-05 09:31:33 UTC (rev 6823)
@@ -63,20 +63,10 @@
{
if(!$this->executor)
{
- $this->compiled_file = $this->locator->locateCompiledTemplate($this->file);
+ list($this->compiled_file, $macro_executor_class) = $this->compile($this->file);
- if($this->config['is_force_compile'] || !file_exists($this->compiled_file))
- {
- $macro_executor_class = 'MacroTemplateExecutor' . uniqid();//think about evaling this instance
-
- $compiler = $this->_createCompiler();
- $compiler->compile($this->file, $this->compiled_file, $macro_executor_class, 'render');
- //appending macro executor class
- file_put_contents($this->compiled_file, file_get_contents($this->compiled_file) .
- "\n\$macro_executor_class='$macro_executor_class';");
- }
-
include($this->compiled_file);
+
$this->executor = new $macro_executor_class($this->config);
}
@@ -92,7 +82,25 @@
ob_end_clean();
return $out;
}
+
+ function compile($source_file)
+ {
+ $compiled_file = $this->locator->locateCompiledTemplate($source_file);
+ if($this->config['is_force_compile'] || !file_exists($compiled_file))
+ {
+ $macro_executor_class = 'MacroTemplateExecutor' . uniqid();//think about evaling this instance
+
+ $compiler = $this->_createCompiler();
+ $compiler->compile($source_file, $compiled_file, $macro_executor_class, 'render');
+ //appending macro executor class
+ file_put_contents($compiled_file, file_get_contents($compiled_file) .
+ "\n\$macro_executor_class='$macro_executor_class';");
+ }
+
+ return array($compiled_file, $macro_executor_class);
+ }
+
protected function _createCompiler()
{
lmb_require('limb/macro/src/compiler/*.interface.php');
More information about the limb-svn
mailing list