JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform actually sends e-mails now. and presents thankyou message
[wfpl.git] / template.php
index c56e743..239630c 100644 (file)
@@ -34,6 +34,7 @@
 # including the use of sub-templates can be found in tem_test.php
 
 require_once('code/wfpl/encode.php');
+require_once('code/wfpl/basics.php');
 
 class tem {
        var $keyval;        # an array containing key/value pairs 
@@ -76,11 +77,12 @@ class tem {
                                return;
                        }
 
+                       # move everything up to (but not including) <!-- to the output
                        $out .= substr($in, 0, $n);
                        $in = substr($in, $n);
 
-                       #we found something.
-                       #is it an end tag?
+                       # we found something.
+                       # is it an end tag?
                        if(strcmp('<!--~end~-->', substr($in, 0, 12)) == 0) {
                                $in = substr($in, 12);
                                return;
@@ -88,7 +90,7 @@ class tem {
 
                        $matches = array();
                        # this limits sub_template names to 50 chars
-                       if(ereg('<!--~([^~]*) start~-->', substr($in, 0, 65), $matches)) {
+                       if(ereg('^<!--~([^~]*) start~-->', substr($in, 0, 65), $matches)) {
                                list($start_tag, $tag_name) = $matches;
                                $out .= '~' . $tag_name . '~';
                                $in = substr($in, strlen($start_tag));
@@ -184,16 +186,6 @@ function tem_output($filename = false) {
 
 
 
-function read_whole_file($name) {
-       $fd = fopen($name, 'r');
-       if($fd === false) {
-               die("Failed to read file: '$name'");
-       }
-       $temp = fread($fd, filesize($name));
-       fclose($fd);
-       return $temp;
-}
-
 # this is used in template_run() and should be of no other use
 function template_filler($matches) {
        list($tag, $enc) = explode('.', $matches[1], 2);