X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwt.php;h=82629ffcf19be9bc1693766e3e69f34ba063b196;hb=cf5d0ee46eaa0239459a54464e5983a3e2645852;hp=49fac824a81bd1ed08ff8aa8f7d5f3f0a7351412;hpb=6126e566b80bd1eb4dd3212481fa4b854bdc3549;p=wfpl.git diff --git a/dwt.php b/dwt.php index 49fac82..82629ff 100644 --- a/dwt.php +++ b/dwt.php @@ -32,11 +32,15 @@ function dwt_init() { dwt_reset(); } -function dwt_load($filename) { - $GLOBALS['_dwt_template'] = read_whole_file($filename); +function dwt_load_str($str) { + $GLOBALS['_dwt_template'] = $str; dwt_init(); } +function dwt_load($filename) { + dwt_load_str(read_whole_file($filename)); +} + function dwt_set_raw($name, $value) { $GLOBALS['_dwt_keys'][] = $name; $GLOBALS['_dwt_values'][] = $value; @@ -61,15 +65,19 @@ function dwt_find($name) { return dwt_find_raw(""); } -function dwt_append($name, $value) { - $index = dwt_find($name); +function dwt_append_raw($name, $value) { + $index = dwt_find_raw($name); if($index !== null) { $GLOBALS['_dwt_values'][$index] .= $value; } else { - dwt_set($name, $value); + dwt_set_raw($name, $value); } } +function dwt_append($name, $value) { + dwt_append_raw("", $value); +} + function dwt_output($filename = null) { if($filename !== null) { dwt_load($filename);