|
From: andi <bin...@li...> - 2001-09-25 22:51:56
|
andi Tue Sep 25 15:51:51 2001 EDT
Modified files:
/r2/binarycloud/base/mod/bcc BccModuleCompiler.php
Log:
BccModuleCompiler works now with SML Syntax !!
Index: r2/binarycloud/base/mod/bcc/BccModuleCompiler.php
diff -u r2/binarycloud/base/mod/bcc/BccModuleCompiler.php:1.1 r2/binarycloud/base/mod/bcc/BccModuleCompiler.php:1.2
--- r2/binarycloud/base/mod/bcc/BccModuleCompiler.php:1.1 Sat Sep 22 12:58:15 2001
+++ r2/binarycloud/base/mod/bcc/BccModuleCompiler.php Tue Sep 25 15:51:51 2001
@@ -1,7 +1,7 @@
<?php
// Header {{{
/*
- * -File $Id: BccModuleCompiler.php,v 1.1 2001/09/22 19:58:15 andi Exp $
+ * -File $Id: BccModuleCompiler.php,v 1.2 2001/09/25 22:51:51 andi Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Andreas Aderhold
* -Authors Andreas Aderhold, <an...@bi...>
@@ -13,38 +13,49 @@
// {{{ BccModuleCompiler
class BccModuleCompiler {
- var $output = false; // echo output or return
- var $data = ""; // will contain the tag to compile
+ /* config var, echo output? */
+ var $output = false;
+
+ /* config var, tagdata to compile */
+ var $data = "";
+
+ /* internal buffer */
+ var $compiled =""; // compiled data buffer
+
+
+ /** */
function BccModuleCompiler($_params) {
extract_params($this, $_params);
- // compile tag in $this->data
+ import('ext.metabase.xml_parser');
+ import('binarycloud.lib.XMLUtils');
+
+ $trees = XMLUtils::XMLStr2XML($this->data);
+ $xmlTree = $trees[0];
+ $phpTree = XMLUtils::XML2PHP($xmlTree);
+ $txtTree = XMLUtils::PHP2PHPArr($phpTree, false);
+ $this->compiled = str_replace(');',')', $txtTree);
+
return true;
}
+ /** */
function Output() {
- $strBuffer = "Module Compiler Output";
- if ($this->output != true) {
- return $strBuffer;
+ $strFormat = "<? global \$Page;\n\$Page->BuildStaticModule(".$this->compiled.");\n?>";
+ if (!$this->error) {
+ if ($this->output != true) {
+ return $strFormat;
+ } else {
+ echo $strFormat;
+ }
} else {
- echo $strBuffer;
+ echo $this->error;
+ return false;
}
}
}
-/*
-function BCCompileModuleTag($_tags) {
- // translating xml to php by using XMLUtils
- // this seems not to work for tag attributes
-
- $trees = XMLUtils::XMLStr2XML($_tags);
- $xmlTree = $trees[0];
- $phpTree = XMLUtils::XML2PHP($xmlTree);
- $txtTree = XMLUtils::PHP2PHPArr($phpTree,false);
- return $txtTree;
-}
-*/
// }}}
/*
* Local Variables:
|