[phpwebapp-commits] CVS: web_app/parser class.WebPage.php,1.6,1.7 class.WebObjectTpl.php,1.4,1.5 cla
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2003-08-23 02:58:48
|
Update of /cvsroot/phpwebapp/web_app/parser In directory sc8-pr-cvs1:/tmp/cvs-serv6393/parser Modified Files: class.WebPage.php class.WebObjectTpl.php class.WebObject.php class.WebClassTpl.php class.VarStack.php class.Template.php class.RepeatTpl.php class.Render.php class.Parser.php class.MainTpl.php class.IfTpl.php class.FileTpl.php Log Message: modified a little bit the comments Index: class.WebPage.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.WebPage.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** class.WebPage.php 20 Aug 2003 07:00:49 -0000 1.6 --- class.WebPage.php 22 Aug 2003 15:54:42 -0000 1.7 *************** *** 11,26 **** class WebPage { ! var $tpl_file; //the file name of the main template ! var $rootTpl; //reference to the main template of the page ! var $tpl_collection; //collection of all the templates of the page ! var $rs_collection; //collection of all the recordsets of the page ! //keeps a list of messages that are displayed with alert() ! //to the user after the page is loaded var $messages; ! //keeps a list of debug messages that are displayed ! //after the page is rendered var $dbg_messages; --- 11,32 ---- class WebPage { ! /** The file name of the main template. */ ! var $tpl_file; ! ! /** Reference to the main template of the page. */ ! var $rootTpl; ! /** Collection of all the templates of the page. */ ! var $tpl_collection; ! /** Collection of all the recordsets of the page. */ ! var $rs_collection; ! ! /** Keeps a list of messages that are displayed with alert() ! * to the user after the page is loaded. */ var $messages; ! /** Keeps a list of debug messages that are displayed ! * after the page is rendered. */ var $dbg_messages; *************** *** 41,46 **** } ! /** ! * Append the given line to the content of the <head> element. */ function append_to_head($line) { --- 47,51 ---- } ! /** Append the given line to the content of the <head> element. */ function append_to_head($line) { *************** *** 48,53 **** } ! /** ! * Append the given line to the content of the <body> element. */ function append_to_body($line) { --- 53,57 ---- } ! /** Append the given line to the content of the <body> element. */ function append_to_body($line) { *************** *** 55,59 **** } ! /** adds a template in the template collection */ function addTemplate($tpl) { --- 59,63 ---- } ! /** Adds a template in the template collection. */ function addTemplate($tpl) { *************** *** 105,109 **** } ! /** adds a recordset in the recordset collection */ function addRecordset(&$rs) { --- 109,113 ---- } ! /** Adds a recordset in the recordset collection. */ function addRecordset(&$rs) { *************** *** 123,144 **** } - /** adds a recordset in the recordset collection */ - function setRecordset(&$rs) - { - static $rsId = "recordset_00"; - if (!isset($rs->ID)) - { - print WebApp::error_msg("Error:WebPage::setRecordset(): unidentified recordset.\n"); - print $rs->toHtmlTable(); - return; - } - else if ($rs->ID==UNDEFINED) - { - $rsId++; - $rs->ID = $rsId; - } - $this->rs_collection[$rs->ID] = $rs; - } - /** * Returns the recordset with the given id from the collection, --- 127,130 ---- *************** *** 158,161 **** --- 144,148 ---- } + /** Add a debug message to the list of debug messages. */ function addDbgMsg($dbg_msg, $comment ="") { *************** *** 166,171 **** /** ! * returns JS code that displays an alert for ! * each message in the messages array */ function messages_to_js() --- 153,158 ---- /** ! * Returns JS code that displays an alert for ! * each message in the messages array. */ function messages_to_js() *************** *** 205,209 **** /*------------------ debug functions --------------------------*/ ! /** outputs the data of each template in $this->tpl_collection */ function template_list() { --- 192,196 ---- /*------------------ debug functions --------------------------*/ ! /** (debug) Outputs the data of each template in $this->tpl_collection. */ function template_list() { *************** *** 237,241 **** } ! /** returns the structure of the loaded templates as a tree */ function tpl_to_tree() //for debugging parse() { --- 224,228 ---- } ! /** (debug) Returns the structure of the loaded templates as a tree. */ function tpl_to_tree() //for debugging parse() { *************** *** 250,257 **** /** ! * returns a string in html format which displays * all the recordsets in $this->rs_collection */ ! function recordsets_to_html() //for debugging openRecordsets() { $html_recs = "<hr>\n"; --- 237,245 ---- /** ! * Returns a string in html format which displays * all the recordsets in $this->rs_collection + * (for debugging Recordsets). */ ! function recordsets_to_html() { $html_recs = "<hr>\n"; Index: class.WebObjectTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.WebObjectTpl.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.WebObjectTpl.php 11 Aug 2003 16:17:51 -0000 1.4 --- class.WebObjectTpl.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 1,13 **** <?php ! /** @package parser */ class WebObjectTpl extends Template { ! var $class; //a reference to the WebClassTpl of this objectTpl ! var $params; //an associative array of parameters and their values ! var $scope; //a reference to the scope of the object in the var stack ! var $obj_count; //the count of the object ! function WebObjectTpl($webObjId) //constructor { //call constructor of the superclass --- 1,26 ---- <?php ! /** ! * The template of a <WebObject> tag (which is copied ! * from the corresponding WebClass). ! * @package parser ! */ class WebObjectTpl extends Template { ! /** A reference to the WebClassTpl of this objectTpl. ! * @see WebClassTpl */ ! var $class; ! /** An associative array of parameters and their values. */ ! var $params; ! /** A reference to the scope of the object in the var stack. */ ! var $scope; ! ! /** The count of the object. */ ! var $obj_count; ! ! ! /** Constructor */ ! function WebObjectTpl($webObjId) { //call constructor of the superclass *************** *** 35,38 **** --- 48,52 ---- } + /** This is called after the template of the WebObject is parsed. */ function after_parse() { *************** *** 44,52 **** /** ! * this function is called by beforeParse(); ! * if the event is targeted to this webobj, it calls ! * the event hadler of the event, which has the same ! * name as the event; if a specific event handler does ! * not exist, it calls eventHandler() of the webclass */ function handle_event() --- 58,67 ---- /** ! * This function is called by beforeParse(). ! * - If the event is targeted to this webobj, it calls ! * the event hadler of the event, which has the same ! * name as the event. ! * - If a specific event handler does not exist, ! * it calls eventHandler() of the webclass. */ function handle_event() *************** *** 72,76 **** } ! /** returns an array with all the evaluated parameters */ function getParams() { --- 87,91 ---- } ! /** Returns an array with all the evaluated parameters. */ function getParams() { *************** *** 123,128 **** } ! function attribs2html() //for debugging output ! { reset($this->params); while ( list($p_name,$expr) = each($this->params) ) --- 138,143 ---- } ! /** debug */ ! function attribs2html() { reset($this->params); while ( list($p_name,$expr) = each($this->params) ) Index: class.WebObject.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.WebObject.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.WebObject.php 11 Aug 2003 16:17:51 -0000 1.4 --- class.WebObject.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 2,52 **** /** * This is like an interface or a general class that should be ! * extended by all the PHP classes of the <WebClass>-es. ! * * @package parser */ class WebObject extends WebObjectTpl { ! function init() ! { ! //This is an abstract function ! //that can be overriden by subclasses. ! //It is called only the first time that ! //the webobj is created (only once in a session) ! //and can be used to initialize the state variables ! } ! function eventHandler($event) ! { ! //This is an abstract function ! //that can be overriden by subclasses. ! //It is called by the framework when ! //an event is sent to the webobj. ! } ! function onParse() ! { ! //This is an abstract function ! //that can be overriden by subclasses. ! //This is called by the framework before ! //the webobj is parsed. ! } ! function afterParse() ! { ! //This is an abstract function ! //that can be overriden by subclasses. ! //This is called by the framework after ! //the webobj is parsed. ! } ! function onRender() ! { ! //This is an abstract function ! //that can be overriden by subclasses. ! //This is called by the framework before ! //the webobj is rendered. It is usually used ! //to add variables that are used in the template. ! } /** empty constructor */ --- 2,52 ---- /** * This is like an interface or a general class that should be ! * extended by all the PHP classes of the <WebClass> and <WebBox> ! * elements. * @package parser */ class WebObject extends WebObjectTpl { ! /** ! * This is an abstract function ! * that can be overriden by subclasses. ! * It is called only the first time that ! * the webobj is created (only once in a session) ! * and can be used to initialize the state variables. ! */ ! function init() {} ! /** ! * This is an abstract function ! * that can be overriden by subclasses. ! * It is called by the framework when ! * an event is sent to the webobj. ! */ ! function eventHandler($event) {} ! /** ! * This is an abstract function ! * that can be overriden by subclasses. ! * This is called by the framework before ! * the webobj is parsed. ! */ ! function onParse() {} ! /** ! * This is an abstract function ! * that can be overriden by subclasses. ! * This is called by the framework after ! * the webobj is parsed. ! */ ! function afterParse() {} ! /** ! * This is an abstract function ! * that can be overriden by subclasses. ! * This is called by the framework before ! * the webobj is rendered. It is usually used ! * to add variables that are used in the template. ! */ ! function onRender() {} /** empty constructor */ *************** *** 86,90 **** } ! /** add state var (session var) */ function addSVar($var_name, $var_value, $db =false) { --- 86,90 ---- } ! /** Add state var (session var). */ function addSVar($var_name, $var_value, $db =false) { *************** *** 94,98 **** } ! /** $arr_vars is an associative array */ function addSVars($arr_vars, $db =false) { --- 94,98 ---- } ! /** $arr_vars is a list of vars (an associative array). */ function addSVars($arr_vars, $db =false) { *************** *** 129,134 **** * The optional parameter $type accepts the values "DB" * and "JS", and depending on this parameter the function ! * returns DB vars, JS vars or all of them (if undefined) ! * */ function getSVars($type =UNDEFINED) --- 129,133 ---- * The optional parameter $type accepts the values "DB" * and "JS", and depending on this parameter the function ! * returns DB vars, JS vars or all of them (if undefined). */ function getSVars($type =UNDEFINED) Index: class.WebClassTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.WebClassTpl.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** class.WebClassTpl.php 11 Aug 2003 16:17:51 -0000 1.5 --- class.WebClassTpl.php 22 Aug 2003 15:54:42 -0000 1.6 *************** *** 1,11 **** <?php ! /** @package parser */ class WebClassTpl extends Template { ! var $path; //path where the WebClassTpl is located ! var $params; //array of parameters and their default values ! /** the number of the objects of this class, it is ! * incremented each time that a new object is created */ var $obj_count; --- 1,18 ---- <?php ! /** ! * The template of a <WebClass> element. ! * @package parser ! */ class WebClassTpl extends Template { ! /** Path where the WebClassTpl is located. */ ! var $path; ! /** Array of parameters and their default values. */ ! var $params; ! ! /** ! * The number of the objects of this class. It is ! * incremented each time that a new object is created. */ var $obj_count; *************** *** 33,37 **** } ! /** parse the .db file of the webclass, if it exists */ function parse_db_file() { --- 40,44 ---- } ! /** Parse the .db file of the webclass, if it exists. */ function parse_db_file() { *************** *** 50,54 **** * Looks for the PHP file in the same folder as WebClass * (with the same name as the webclass' ID) and includes it ! * if it exists; if not, define a dummy class for this webclass */ function include_php_class() --- 57,61 ---- * Looks for the PHP file in the same folder as WebClass * (with the same name as the webclass' ID) and includes it ! * if it exists; if not, define a dummy class for this webclass. */ function include_php_class() *************** *** 118,122 **** } ! function attribs2html() //for debugging output { reset($this->params); --- 125,130 ---- } ! /** for debug */ ! function attribs2html() { reset($this->params); Index: class.VarStack.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.VarStack.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.VarStack.php 11 Aug 2003 16:17:51 -0000 1.4 --- class.VarStack.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 6,9 **** --- 6,10 ---- class VarStack { + /** array of associative arrays (stack of scopes) */ var $Vars; *************** *** 24,28 **** } ! /** returns a number, which is the index of the current scope */ function getCurrentScope() { --- 25,29 ---- } ! /** Returns a number, which is the index of the current scope. */ function getCurrentScope() { *************** *** 33,38 **** /** ! * add a variable to the specified scope; $scope_nr is optional, ! * if no scope is given, add it to the current scope */ function addVar($var_name, $var_value, $scope_nr=UNDEFINED) --- 34,39 ---- /** ! * Add a variable to the specified scope. $scope_nr is optional, ! * if no scope is given, add it to the current scope. */ function addVar($var_name, $var_value, $scope_nr=UNDEFINED) *************** *** 58,62 **** } ! /** add a variable to the first scope */ function addGlobalVar($var_name, $var_value) { --- 59,63 ---- } ! /** Add a variable to the first scope. */ function addGlobalVar($var_name, $var_value) { *************** *** 65,69 **** } ! /** add a list of vars to the current scope */ function addVars($arrVars) { --- 66,70 ---- } ! /** Add a list of vars to the current scope. */ function addVars($arrVars) { *************** *** 73,77 **** } ! /** add a list of vars to the first scope */ function addGlobalVars($arrVars) { --- 74,78 ---- } ! /** Add a list of vars to the first scope. */ function addGlobalVars($arrVars) { *************** *** 81,87 **** /** ! * returns the value of a variable; if it is not found * in the current scope, the scope above it is searched, ! * and so on; if it is not found at all, UNDEFINED is returned */ function getVar($var_name) --- 82,88 ---- /** ! * Returns the value of a variable. If it is not found * in the current scope, the scope above it is searched, ! * and so on. If it is not found at all, UNDEFINED is returned. */ function getVar($var_name) *************** *** 103,108 **** } ! /** returns the var stack as an HTML table */ ! function toHtmlTable() //for debug { $html = "<strong>VarStack</strong>\n"; --- 104,111 ---- } ! ///////////////////////////////////////////////////////////////// ! ! /** For debug; returns the var stack as an HTML table. */ ! function toHtmlTable() { $html = "<strong>VarStack</strong>\n"; *************** *** 132,137 **** } ! //////////////////////////////////////////// ! function test() //for debug { $vars = new VarStack; --- 135,141 ---- } ! ! /** For test and debug */ ! function test() { $vars = new VarStack; Index: class.Template.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.Template.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** class.Template.php 20 Aug 2003 07:00:49 -0000 1.5 --- class.Template.php 22 Aug 2003 15:54:42 -0000 1.6 *************** *** 1,14 **** <?php ! /** @package parser */ class Template { ! var $id; //template ID ! var $type; //"Template", "If", "Repeat", "WebBox", ! //"IfEmpty", "Header", "Footer" ! var $parent; //the parent template ! ! var $vars; //array that keeps the variables of the template ! var $content; //the lines of the template (array of lines) function Template($tplId =UNDEFINED, $type ="Template") { --- 1,27 ---- <?php ! /** ! * @package parser ! */ class Template { ! /** Template id. */ ! var $id; ! ! /** Template type: ! * 'Template', 'If', 'Repeat', 'WebBox', ! * 'IfEmpty', 'Header', 'Footer' */ ! var $type; + /** The parent template */ + var $parent; + + /** Array that keeps the variables of the template. */ + var $vars; + + /** The lines of the template (array of lines). */ + var $content; + + + /** Constructor */ function Template($tplId =UNDEFINED, $type ="Template") { *************** *** 21,25 **** } ! /** adds a new variable in the array of variables */ function addVar($var_name, $expression) { --- 34,38 ---- } ! /** Adds a new variable in the array of variables. */ function addVar($var_name, $expression) { *************** *** 28,32 **** } ! /** returns an array with all the evaluated variables */ function getVars() { --- 41,45 ---- } ! /** Returns an array with all the evaluated variables. */ function getVars() { *************** *** 41,46 **** } ! /************ debug functions *****************/ ! function toHtmlTable() { --- 54,58 ---- } ! /**#@+ Debug function. */ function toHtmlTable() { *************** *** 67,70 **** --- 79,83 ---- } + /** @see toHtmlTable() */ function attribs2html() { *************** *** 83,86 **** --- 96,100 ---- } + /** @see toHtmlTable() */ function content2html() { *************** *** 106,110 **** } ! /** returns the structure of loaded templates as a tree */ function to_tree($indent) { --- 120,124 ---- } ! /** Returns the structure of loaded templates as a tree. */ function to_tree($indent) { *************** *** 133,138 **** /** ! * prints a preview of this template only (without processing ! * subtemplates), for the benefit of the designer */ function print_preview() --- 147,152 ---- /** ! * Prints a preview of this template only (without processing ! * subtemplates), for the benefit of the designer. */ function print_preview() *************** *** 145,148 **** --- 159,163 ---- } } + /**#@-*/ } ?> Index: class.RepeatTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.RepeatTpl.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** class.RepeatTpl.php 11 Aug 2003 16:17:51 -0000 1.3 --- class.RepeatTpl.php 22 Aug 2003 15:54:42 -0000 1.4 *************** *** 6,14 **** class RepeatTpl extends Template { ! var $rsId; //the id of the recordset ! var $if_empty;//the template that is displayed if the RS is empty ! var $header; //the header template ! var $footer; //the footer template ! var $separator; //the separator template function RepeatTpl($rs_id) --- 6,23 ---- class RepeatTpl extends Template { ! /** The id of the recordset. */ ! var $rsId; ! ! /** The template that is displayed if the RS is empty. */ ! var $if_empty; ! ! /** The header template. */ ! var $header; ! ! /** The footer template. */ ! var $footer; ! ! /** The separator template. */ ! var $separator; function RepeatTpl($rs_id) *************** *** 24,28 **** } ! function attribs2html() //for debugging output { $html = Template::attribs2html() . " --- 33,38 ---- } ! /** for debug */ ! function attribs2html() { $html = Template::attribs2html() . " Index: class.Render.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.Render.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.Render.php 11 Aug 2003 16:17:51 -0000 1.4 --- class.Render.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- * Renders an HTML page from the templates and structures of the $webPage. * @package parser + * @see WebPage */ class Render *************** *** 13,18 **** var $html_page; ! /** helps to render a well-indented page */ var $indent; function Render($collect =false) --- 14,20 ---- var $html_page; ! /** Helps to render a well-indented page. */ var $indent; + function Render($collect =false) Index: class.Parser.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.Parser.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.Parser.php 11 Aug 2003 16:17:51 -0000 1.4 --- class.Parser.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 1,38 **** <?php ! /** @package parser */ class Parser { ! /** a stack of templates that are being parsed */ var $tpl_stack; ! /** the template that is being parsed currently */ var $current_tpl; ! ! /** ! * When $this->silent is true, $this->add_line() does not add ! * lines to the current template. ! */ var $silent; ! ! /** parsing mode, can be "file" or "array" */ var $mode; ! /** the path of the file that is being parsed */ var $path; ! /** the file pointer of the file that is being parsed */ var $fp; ! /** the array of lines that is being parsed */ var $lines; ! /** the index of line that is being parsed */ var $idx; ! /** a stack of the parsing states */ var $state_stack; function Parser() { --- 1,41 ---- <?php ! /** ! * Parses the templates and constructs $webPage, which ! * keeps the structure of the page. ! * ! * @package parser ! * @see WebPage, Render ! */ class Parser { ! /** A stack of templates that are being parsed. */ var $tpl_stack; ! /** The template that is being parsed currently. */ var $current_tpl; ! /** When $this->silent is true, $this->add_line() does not add ! * lines to the current template. */ var $silent; ! /** Parsing mode, can be "file" or "array". */ var $mode; ! /** The path of the file that is being parsed. */ var $path; ! /** The file pointer of the file that is being parsed. */ var $fp; ! /** The array of lines that is being parsed. */ var $lines; ! /** The index of line that is being parsed. */ var $idx; ! /** A stack of the parsing states. */ var $state_stack; + function Parser() { *************** *** 65,68 **** --- 68,72 ---- } + /** Parse the main (root) template of the page. */ function parse_main($tpl_file) { *************** *** 86,94 **** * Parse the filename into the template given as parameter. * ! * @param $filename the file to be parsed ! * @param $tpl (optional) the template or template reference ! * to be filled by parsing this file. ! * @return an object that contains the parsed $filename, ! * return UNDEFINED if $filename is not found. */ function parse_file($filename, $tpl =UNDEFINED) --- 90,98 ---- * Parse the filename into the template given as parameter. * ! * @param $filename the file to be parsed ! * @param $tpl (optional) the template or template reference ! * to be filled by parsing this file. ! * @return FileTpl an object that contains the parsed $filename, ! * return UNDEFINED if $filename is not found. */ function parse_file($filename, $tpl =UNDEFINED) *************** *** 139,149 **** * be parsed more then once (for each webobject of that webclass). * ! * @param $lines the array of lines to be parsed ! * @param $path path of the file from which these lines ! * have been extracted ! * @param $tpl (optional) the template or template reference ! * to be filled by parsing this array. ! * @return an object that contains the parsed $filename, ! * return UNDEFINED if $filename is not found. */ function parse_array($lines, $path, $tpl =UNDEFINED) --- 143,152 ---- * be parsed more then once (for each webobject of that webclass). * ! * @param $lines array lines to be parsed ! * @param $path string path of the file from which these lines ! * have been extracted ! * @param $tpl Template (optional) the template or template reference ! * to be filled by parsing this array ! * @return Template an object that contains the parsed lines */ function parse_array($lines, $path, $tpl =UNDEFINED) *************** *** 187,192 **** /** ! * loads the current template from ! * the file that is being parsed currently */ function parse() --- 190,195 ---- /** ! * Loads the current template from ! * the file that is being parsed currently. */ function parse() *************** *** 202,209 **** /** ! * return true when the line is the closing tag of a template; * if the line contains the opening tag of another template, call * a function to parse this template, else add the line to the ! * current template */ function parse_line($line) --- 205,212 ---- /** ! * Return true when the line is the closing tag of a template; * if the line contains the opening tag of another template, call * a function to parse this template, else add the line to the ! * current template. */ function parse_line($line) *************** *** 290,295 **** /** ! * make the given $tpl current, what will be ! * parsed from now on goes to this template */ function push(&$tpl) --- 293,298 ---- /** ! * Make the given $tpl current, what will be ! * parsed from now on goes to this template. */ function push(&$tpl) *************** *** 308,314 **** /** ! * the parsing of the current template ! * has finished; store it in template collection ! * and make current the top of the stack */ function pop() --- 311,317 ---- /** ! * The parsing of the current template has finished; ! * store it in template collection (in $webPage) ! * and make current the top of the stack. */ function pop() *************** *** 328,338 **** /** ! * copies the content of the element $tag_name ! * into $this->current_tpl->content; the difference * between copy_element() and parse() is that parse() * builds the template structure of the element, * however copy_element() just copies all the lines ! * up to the closing tag, without interpreting the template tags ! * $depth is the depth of recursion */ function copy_element($elem_tag, $depth =0) --- 331,341 ---- /** ! * Copies the content of the element $tag_name ! * into $this->current_tpl->content. The difference * between copy_element() and parse() is that parse() * builds the template structure of the element, * however copy_element() just copies all the lines ! * up to the closing tag, without interpreting the template tags. ! * @param $depth number the depth of recursion */ function copy_element($elem_tag, $depth =0) *************** *** 375,380 **** /** ! * creates and returns a new If template; ! * $line contains the starting tag of the If element */ function new_If($line) --- 378,384 ---- /** ! * Creates and returns a new If template. ! * @param $line string contains the starting tag of the If element ! * @return IfTpl */ function new_If($line) *************** *** 385,389 **** } ! /** creates and returns a new Template template; */ function new_Template($line) { --- 389,396 ---- } ! /** ! * Creates and returns a new Template template. ! * @return Template ! */ function new_Template($line) { *************** *** 393,398 **** /** ! * creates and returns a new Repeat template; ! * $line contains the starting tag of the Repeat element */ function new_Repeat($line) --- 400,406 ---- /** ! * Creates and returns a new Repeat template. ! * @param $line string contains the starting tag of the Repeat element ! * @return RepeatTpl */ function new_Repeat($line) *************** *** 403,407 **** } ! /** $tag has the values "IfEmpty", "Header", "Footer" or "Separator" */ function parse_Repeat_subtpl($tag) { --- 411,418 ---- } ! /** ! * $tag has the values "IfEmpty", "Header", "Footer" or "Separator" ! * @return Template ! */ function parse_Repeat_subtpl($tag) { *************** *** 838,844 **** /** ! * if the $line starts with an opening or closing tag ! * ('<tag_name' or '</tag_name') then it returns it ! * otherwise returns UNDEFINED */ function get_tag_name($line) --- 849,855 ---- /** ! * If the $line starts with an opening or closing tag ! * ('<tag_name' or '</tag_name') then it returns it, ! * otherwise returns UNDEFINED. */ function get_tag_name($line) *************** *** 856,862 **** /** ! * returns the value of the given attribute from the given * line (assuming that the line is a start element), or ! * UNDEFINED if not found */ function get_attr_value($line, $attrib) --- 867,873 ---- /** ! * Returns the value of the given attribute from the given * line (assuming that the line is a start element), or ! * UNDEFINED if not found. */ function get_attr_value($line, $attrib) *************** *** 877,882 **** ///////////////////////////////////////////////////////////// ! /** ! * Output the state of the parser. */ function debug() { --- 888,892 ---- ///////////////////////////////////////////////////////////// ! /** Output the state of the parser. */ function debug() { Index: class.MainTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.MainTpl.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** class.MainTpl.php 11 Aug 2003 16:17:52 -0000 1.4 --- class.MainTpl.php 22 Aug 2003 15:54:42 -0000 1.5 *************** *** 1,13 **** <?php /** ! * Represents the main (root) template in the page configuration. ! * * @package parser */ class MainTpl extends FileTpl { ! var $head; //template of the <head> of the page ! var $body; //template of the <body> of the page ! function MainTpl($filename) { --- 1,15 ---- <?php /** ! * Represents the main (root) template in the tree of templates. * @package parser */ class MainTpl extends FileTpl { ! /** Template of the <head> of the page. */ ! var $head; ! ! /** Template of the <body> of the page. */ ! var $body; ! function MainTpl($filename) { *************** *** 21,25 **** } ! /** returns the structure of loaded templates as a tree */ function to_tree() { --- 23,27 ---- } ! /** Debug function. Returns the structure of loaded templates as a tree. */ function to_tree() { Index: class.IfTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.IfTpl.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** class.IfTpl.php 11 Aug 2003 16:17:52 -0000 1.3 --- class.IfTpl.php 22 Aug 2003 15:54:42 -0000 1.4 *************** *** 2,6 **** /** * A template that is renderd if the condition evaluates to true. - * * @package parser */ --- 2,5 ---- *************** *** 16,21 **** $this->condition = $condition; } ! ! function attribs2html() //for debugging output { $html = Template::attribs2html() . " --- 15,21 ---- $this->condition = $condition; } ! ! /** for debug */ ! function attribs2html() { $html = Template::attribs2html() . " Index: class.FileTpl.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/parser/class.FileTpl.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** class.FileTpl.php 11 Aug 2003 16:17:52 -0000 1.3 --- class.FileTpl.php 22 Aug 2003 15:54:42 -0000 1.4 *************** *** 2,7 **** /** * A template that contains the content of a file that is ! * being parsed, e.g. the main file or a file that is included. ! * * @package parser */ --- 2,6 ---- /** * A template that contains the content of a file that is ! * being parsed, e.g. the root file or a file that is included. * @package parser */ *************** *** 20,24 **** } ! /** trims the indentation from the beginning of each line */ function unindent() { --- 19,23 ---- } ! /** Trims the indentation from the beginning of each line. */ function unindent() { *************** *** 31,35 **** } ! function attribs2html() //for debugging output { $html = Template::attribs2html() . " --- 30,35 ---- } ! /** for debug */ ! function attribs2html() { $html = Template::attribs2html() . " |