cvs: pear /HTML_Template_Flexy Flexy.php

From: Date: Thu, 26 Jun 2003 05:40:53 +0000
Subject: cvs: pear /HTML_Template_Flexy Flexy.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11175@lists.php.net to get a copy of this message
alan_k Thu Jun 26 01:40:53 2003 EDT Modified files: /pear/HTML_Template_Flexy Flexy.php Log: tidy up unlinks, add a bit more debugging code in there Index: pear/HTML_Template_Flexy/Flexy.php diff -u pear/HTML_Template_Flexy/Flexy.php:1.32 pear/HTML_Template_Flexy/Flexy.php:1.33 --- pear/HTML_Template_Flexy/Flexy.php:1.32 Wed Jun 11 08:04:21 2003 +++ pear/HTML_Template_Flexy/Flexy.php Thu Jun 26 01:40:53 2003 @@ -42,7 +42,7 @@ * - heavily focused on displaying objects as pages. * (so you can document your tags.) * -* @version $Id: Flexy.php,v 1.32 2003/06/11 12:04:21 alan_k Exp $ +* @version $Id: Flexy.php,v 1.33 2003/06/26 05:40:53 alan_k Exp $ */ class HTML_Template_Flexy { @@ -343,8 +343,13 @@ // note this should be moved to new HTML_Template_Flexy_Token // and that can then manage all the tokens in one place.. - + if (@$this->options['debug']) { + echo "compiling template $this->currentTemplate<BR>"; + + } require_once 'HTML/Template/Flexy/Tokenizer.php'; + + $this->_elements = array(); $GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions'] = $this->options; @@ -369,7 +374,11 @@ $data = $res->toString(); - + if (@$this->options['debug']) { + echo "<B>Result: </B>".htmlspecialchars($data)."<BR>"; + + } + if ($this->options['nonHTML']) { $data = str_replace("?>\n","?>\n\n",$data); } @@ -377,13 +386,23 @@ // error checking? if( ($cfp = fopen( $this->compiledTemplate , 'w' )) ) { + if (@$this->options['debug']) { + echo "<B>Writing: </B>".htmlspecialchars($data)."<BR>"; + + } fwrite($cfp,$data); fclose($cfp); @chmod($this->compiledTemplate,0775); + + + + } else { + PEAR::raiseError('HTML_Template_Flexy::failed to write to '.$this->compiledTemplate,null,PEAR_ERROR_DIE); } - // gettext strings - @unlink($this->gettextStringsFile); + if (file_exists($this->gettextStringsFile)) { + unlink($this->gettextStringsFile); + } if($GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['gettextStrings'] && ($cfp = fopen( $this->getTextStringsFile, 'w') ) ) { @@ -393,7 +412,10 @@ } // elements - @unlink($this->elementsFile); + if (file_exists($this->elementsFile)) { + unlink($this->elementsFile); + } + if($this->_elements && ($cfp = fopen( $this->elementsFile, 'w') ) ) {

« previous php.pear.cvs (#11175) next »