1 First you have some globally accessible array of key->value pairs which contain the data to be entered into templates
3 Then you have some template files
7 tem_run($file/template)
8 tem_echo($file/template) { echo tem_run($file); }
10 This should work for simple templates such as: foo: '~foo~'
13 It gets trickier when you have bits in your template that need to be repeated
14 (with different tags each time) and others perhaps not displayed at all.
19 <tr><th>foo</th><th>bar</th></tr>
20 <!--~foobar_row start~--><tr><td>~foo~</td><td><input value="~bar~"></tr><!--~end~-->
23 tem_load('foobar.html');
26 the main template (with the sub-templates like foobar_row replaced with a single tag ie:
29 <tr><th>foo</th><th>bar</th></tr>
35 template file (if template string is empty, it will be read from here)
39 value: <tr><td>~foo.....html~</td><td><input value="~bar.attr~"></tr>
42 tmpl_insert('foobar_row');