3 require_once('YATT.class.php');
7 $n->load("example.yatt");
10 $n->set('CRACK', 'eat me');
13 $n->set(array("FOO" => "something else", "BAR" => "barorific!"));
15 # Variable substitution is recursive, see how this works in the template
16 $n->set('FNORK', 'baz');
17 $n->set('CORK_baz', 'shout off and die');
19 # Parse a single block of text
20 $n->parse('faz.test');
23 foreach (array("ONE", "TWO", "THREE") as $value) {
24 $n->set('ROW_NAME', $value);
25 $n->parse('faz.table.row');
27 $n->parse('faz.table');
29 # Comment this out and look at the output.
30 # Notice that everything *but* what is in faz is displayed.
31 # Only nodes that you parse() actually display things.
34 # print the output for everything.
35 # You could also tell it where to start, like output('faz.table')
36 # to only print out stuff from table.
37 print "--------------------------------------------------------------\n";
38 print "Output of the template:\n";
39 print "--------------------------------------------------------------\n";
42 # If there were any errors, print them out
43 # You should probably check this *before* you print out the page
44 # because these errors will likely cause the page not to be
45 # built correctly. It is done this way so that you only have to
46 # check once, and so you can do something cool with the errors
48 if (($e = $n->get_errors())) {
49 print "--------------------------------------------------------------\n";
51 print "--------------------------------------------------------------\n";