JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
use local less.js when running locally
[wfpl.git] / doc / template.php.txt
1 First, create a template object:
2
3         $tem = new Tem();
4
5 Then, load a template file (note: this can be done after you put the values in)
6
7         $tem->load('template.html');
8         # or
9         $tem->load_str("""
10         <head><title>~title html~</title></head>
11         <body><table>
12                 <th>Letter</th><th>Is For</th>
13                 <!--~alphabet_table {~-->
14                         <td>~letter html~</td><td>~is_for html~</td>
15                 <!--~end~-->
16         </table></body></html>""");
17
18 Then give it some data:
19
20         $tem->set('title', 'Example Template Output');
21         $tem->set('alphabet_table', array(
22                 array('letter' => 'A', 'is_for' => '<A>pple'),
23                 array('letter' => 'B', 'is_for' => '<B>anana')));
24
25 Then you can get/print the output:
26
27         echo $tem->run();
28
29 And you should see this:
30
31         <head><title>Example Template Output</title></head>
32         <body><table>
33                 <th>Letter</th><th>Is For</th>
34                         <td>A</td><td>&gt;A&lt;pple</td>
35                         <td>B</td><td>&gt;B&lt;anana</td>
36         </table></body></html>