1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <!-- This file is an example template for wfpl/template.php. It contains two
4 special things: sub-templates and template tags. -->
6 <html xmlns="http://www.w3.org/1999/xhtml">
12 <h1>Template Test Page</h1>
14 <!-- Here's the first special thing. This marks the begining of a
15 sub-template. It marks a section of template which the php can decide how
16 many times to display (including none.) -->
19 <h3>Please Log In Below</h3>
21 <form method="get" action="tem_test.php">
26 <!-- Neatly tucked into the next line is a template tag. This will be
27 replaced with content from PHP. Every template tag has a name ("user"
28 in this case) which says which value from php goes here, and should
29 also have an encoding ("attr" in this case). It is important to always
30 use the correct encoding. If you are putting the value in an html
31 attribute, use "attr" if you are displaying it use "html", if you are
32 putting it in a text file or e-mail then leave the encoding off and
35 <td><input type="text" name="user" value="~user.attr~" /></td>
41 <!-- there's another template tag named pass -->
43 <td><input type="password" name="pass" value="~pass.attr~" /></td>
47 <td colspan="2"><input type="submit" value="Log In" /></td>
52 <!-- and here's the mark for the end of the login sub-template. -->
57 <!-- Now for a more complex example of sub-templates. This whole table is in
58 a sub-template so php can decide to display the whole bit or not. First the
59 marker for the begining of the sub-template -->
61 <!--~foobar_table start~-->
62 <h3>All your foobar:</h3>
71 <!-- OK, here's the fun part. We want PHP to be able to display many rows
72 in this table, so we make a template with just one row, and mark that row
73 as a sub-template named foobar_row -->
75 <!--~foobar_row start~-->
77 <!-- sorry that the following tag looks a bit like a filename. It isn't.
78 It's simply asking PHP for a value called "foo" encoded as html -->
81 <td><input value="~bar.attr~" /></td>
83 <!-- Here's the end of foobar_row -->
89 <td><input type="submit" /></td>
93 <!-- and the end of foobar_table -->