Updating test files to ISSO2 setup
[isso.git] / dev / conditionaltest.php
1 <?php
2 // <if> conditional tests
3 // $Id$
4 // $Author$
5 // $Revision$
6 // $Date$
7 // $HeadURL$
8
9 require_once('../kernel.php');
10 $isso = new Shared_Object_Framework();
11
12 $isso->set('apppath', getcwd());
13 $isso->set('sourcepath', $isso->get('apppath') . '../');
14 $isso->set('application', 'Template Test');
15 $isso->set('appversion', '$Id$');
16 $isso->set('debug', true);
17
18 $isso->load('template', 'template', true);
19
20 // ###################################################################
21
22 $data = '<tr valign="middle">
23 <td class="alt1">
24 <span style="float: right; display: inline" class="smallfont">
25 1 <if condition="$show[\'edit\']">
26 2 <if condition="$show[\'receive\']">
27 <a href="item.php?do=finishget&amp;id=$iteminfo[itemid]" title="Remove"><img src="{$template->templatedir}images/remove_item.png" alt="Remove Item" border="0" /></a>
28 2.1 <else />
29 <a href="item.php?do=edit&amp;id=$iteminfo[itemid]" title="Edit"><img src="{$template->templatedir}images/edit_item.png" alt="Edit Item" border="0" /></a>
30 <a href="item.php?do=got&amp;id=$iteminfo[itemid]" title="Received"><img src="{$template->templatedir}images/receive_item.png" alt="Received Item" border="0" /></a>
31 /2 </if>
32 1.1 <else />
33 3 <if condition="$show[\'purchase\'] OR $show[\'unpurchase\']">
34 4 <if condition="$show[\'purchase\']">
35 <a href="item.php?do=purchase&amp;id=$iteminfo[itemid]" title="Purchase"><img src="{$template->templatedir}images/purchase_item.png" alt="Purchase Item" border="0" /></a>
36 /4 </if>
37 5 <if condition="$show[\'unpurchase\']">
38 <a href="item.php?do=unpurchase&amp;id=$iteminfo[itemid]" title="Un-purchase"><img src="{$template->templatedir}images/unpurchase_item.png" alt="Un-purchase Item" border="0" /></a>
39 /5 </if>
40 3.1 <else />
41 (<a href="mailto:$iteminfo[email]">$iteminfo[email]</a>)
42 /3 </if>
43 /1 </if>
44 </span>
45
46 <if condition="$iteminfo[\'url\']"><a href="$iteminfo[url]" target="_blank">$iteminfo[name]</a><else />$iteminfo[name]</if>
47 </td>
48 <td class="alt2">$iteminfo[price]</td>
49 <td class="alt1">$iteminfo[rating]</td>
50 <td class="alt2">$iteminfo[notes]</td>
51 <td class="alt1">$iteminfo[dateline]</td>
52 </tr>';
53
54 // ###################################################################
55
56 $data2 = '1 <if condition="test"> -0
57 2 <if condition="hi"> -1
58 moo
59 2.1 <else /> -1
60 boo
61 3 <if condition="a"> -2
62 dad
63 3.1 <else /> -2
64 ghost
65 /3 </if> -2
66 /2 </if> -1
67 1.1 <else /> -0
68 hi there
69 4 <if condition="hi"> -1
70 mom
71 4.1 <else /> -1
72 5 <if condition="asdfa"> -2
73 moo
74 5.1 <else /> -2
75 adfds
76 /5 </if> -2
77 /4 </if> -1
78 /1 </if> -0';
79
80 // ###################################################################
81
82 $data3 = 'hey there
83 this is a test
84 <if condition="a">
85 hi
86 <else />
87 booo
88 </if>
89 moo
90 moo
91 moo';
92
93 // ###################################################################
94
95 $parsed = $template->_parse($data2);
96
97 echo '<pre>';
98
99 echo highlight_string('$test = "' . $parsed . '";', true);
100
101 echo '<hr />';
102
103 eval('$test = "' . $parsed . '";');
104
105 ?>