# 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
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;
$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));
-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);