JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Fix db_get_value after mysql->mysqli upgrade
[wfpl.git] / test / tem_test.php.html
1 <!DOCTYPE html>
2
3 <!-- This file is an example template for wfpl/template.php. It contains two
4 special things: sub-templates and template tags. -->
5
6 <html>
7 <head>
8   <title></title>
9 </head>
10
11 <body>
12   <h1>Template Test Page</h1>
13   
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.) -->
17   
18   <!--~login {~-->
19   <h3>Please Log In Below</h3>
20
21   <form method="get" action="tem_test.php">
22     <table summary="">
23       <tr>
24         <td>Username:</td>
25
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
33                 just put ~user~. -->
34
35         <td><input type="text" name="user" value="~user attr~"></td>
36       </tr>
37
38       <tr>
39         <td>Password:</td>
40
41         <!-- there's another template tag named pass -->
42
43         <td><input type="password" name="pass" value="~pass attr~"></td>
44       </tr>
45
46       <tr>
47         <td colspan="2"><input type="submit" value="Log In"></td>
48       </tr>
49     </table>
50   </form>
51
52   <!-- and here's the mark for the end of the login sub-template. -->
53
54   <!--~}~-->
55
56
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 -->
60
61   <!--~foobar_table {~-->
62   <h3>All your foobar:</h3>
63
64   <table summary="">
65     <tr>
66       <th>foo</th>
67
68       <th>bar</th>
69     </tr>
70
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 -->
74     
75     <!--~foobar_row {~-->
76     <tr>
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 -->
79       <td>~foo html~</td>
80
81       <td><input value="~bar attr~"></td>
82     </tr>
83     <!-- Here's the end of foobar_row -->
84     <!--~}~-->
85
86     <tr>
87       <td></td>
88       
89       <td><input type="submit"></td>
90     </tr>
91
92   </table>
93   <!-- and the end of foobar_table -->
94   <!--~}~-->
95 </body>
96 </html>