# them is run
require_once('code/wfpl/encode.php');
-require_once('code/wfpl/misc.php'); # to get read_whole_file()
+require_once('code/wfpl/misc.php');
+require_once('code/wfpl/file.php');
class tem {
var $keyval; # an array containing key/value pairs
function output($templ = false) {
print($this->run($templ));
}
+
+ # return the contents of the top-level sub-templates
+ #
+ # this does not run the sub-templates, so if you've not called tem_sub() on them, they will be blank.
+ #
+ # Return a hash.
+ # keys: name of top level sub-template.
+ # values: contents of said sub-template.
+ function top_subs() {
+ $ret = array();
+ if(isset($this->sub_subs['top_level_subs'])) {
+ foreach($this->sub_subs['top_level_subs'] as $name) {
+ $ret[$name] = $this->get($name);
+ }
+ }
+ return $ret;
+ }
}
# Below are functions so you can use the above class without allocating or
return preg_replace_callback(array('|<!--~([^~]*)~-->|', '|~([^~]*)~|', '|<span class="template">([^<]*)</span>|', '|<p class="template">([^<]*)</p>|'), 'template_filler', $template);
}
+function tem_top_subs() {
+ tem_init();
+ return $GLOBALS['wfpl_template']->top_subs();
+}
?>