[limb-svn] r6344 - in 3.x/trunk/limb/view/src: . toolkit
svn at limb-project.com
svn at limb-project.com
Mon Oct 1 01:32:00 MSD 2007
Author: pachanga
Date: 2007-10-01 01:32:00 +0400 (Mon, 01 Oct 2007)
New Revision: 6344
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6344
Added:
3.x/trunk/limb/view/src/lmbMacroView.class.php
Modified:
3.x/trunk/limb/view/src/toolkit/lmbViewTools.class.php
Log:
-- dummy version of lmbMacroView added
Added: 3.x/trunk/limb/view/src/lmbMacroView.class.php
===================================================================
--- 3.x/trunk/limb/view/src/lmbMacroView.class.php (rev 0)
+++ 3.x/trunk/limb/view/src/lmbMacroView.class.php 2007-09-30 21:32:00 UTC (rev 6344)
@@ -0,0 +1,78 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+lmb_require('limb/view/src/macro/lmbMacroTemplate.class.php');
+lmb_require('limb/view/src/lmbView.class.php');
+
+ at define('LIMB_TEMPLATES_INCLUDE_PATH', 'template;limb/*/template');
+ at define('LIMB_MACRO_TAGS_INCLUDE_PATH', 'src/macro;limb/*/src/macro;limb/macro/src/tags');
+
+/**
+ * class lmbMacroView.
+ *
+ * @package view
+ * @version $Id$
+ */
+class lmbMacroView extends lmbView
+{
+ protected $macro_template;
+ protected $cache_dir;
+
+ function setCacheDir($dir)
+ {
+ $this->cache_dir = $dir;
+ }
+
+ function render()
+ {
+ if($tpl = $this->_getMacroTemplate())
+ {
+ $this->_fillMacroTemplate($tpl);
+ return $tpl->render();
+ }
+ }
+
+ function reset()
+ {
+ parent :: reset();
+ $this->macro_template = null;
+ }
+
+ function getMacroTemplate()
+ {
+ return $this->_getMacroTemplate();
+ }
+
+ protected function _getMacroTemplate()
+ {
+ if($this->macro_template)
+ return $this->macro_template;
+
+ if(!$path = $this->getTemplate())
+ return null;
+
+ $this->macro_template = new lmbMacroTemplate($path, $this->_getMacroConfig());
+ return $this->macro_template;
+ }
+
+ protected function _getMacroConfig()
+ {
+ return new lmbMacroConfig($this->cache_dir,
+ true,
+ true,
+ explode(';', LIMB_TEMPLATES_INCLUDE_PATH),
+ explode(';', LIMB_MACRO_TAGS_INCLUDE_PATH));
+ }
+
+ protected function _fillMacroTemplate($template)
+ {
+ foreach($this->getVariables() as $variable_name => $value)
+ $template->set($variable_name, $value);
+ }
+}
+
Modified: 3.x/trunk/limb/view/src/toolkit/lmbViewTools.class.php
===================================================================
--- 3.x/trunk/limb/view/src/toolkit/lmbViewTools.class.php 2007-09-30 21:10:08 UTC (rev 6343)
+++ 3.x/trunk/limb/view/src/toolkit/lmbViewTools.class.php 2007-09-30 21:32:00 UTC (rev 6344)
@@ -10,9 +10,6 @@
@define('LIMB_TEMPLATES_INCLUDE_PATH', 'template;limb/*/template');
@define('LIMB_WACT_TAGS_INCLUDE_PATH', 'src/template/tags;limb/*/src/template/tags;limb/wact/src/tags');
-//TODO: migrate to settings below
-//@define('LIMB_WACT_TAGS_INCLUDE_PATH', 'src/wact;limb/*/src/wact;limb/wact/src/tags');
- at define('LIMB_MACRO_TAGS_INCLUDE_PATH', 'src/macro;limb/*/src/macro;limb/macro/src/tags');
/**
* class lmbViewTools.
More information about the limb-svn
mailing list