]> src.bluestatic.org Git - isso.git/blob - dev/conditionaltest.php
Changes++
[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 ISSO();
11
12 $isso->set('apppath', getcwd());
13 $isso->set('application', 'Template Test');
14 $isso->set('appversion', '$Id$');
15 $isso->set('debug', true);
16
17 $isso->load('template', 'template', true);
18
19 // ###################################################################
20
21 $data = '<tr valign="middle">
22 <td class="alt1">
23 <span style="float: right; display: inline" class="smallfont">
24 1 <if condition="$show[\'edit\']">
25 2 <if condition="$show[\'receive\']">
26 <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>
27 2.1 <else />
28 <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>
29 <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>
30 /2 </if>
31 1.1 <else />
32 3 <if condition="$show[\'purchase\'] OR $show[\'unpurchase\']">
33 4 <if condition="$show[\'purchase\']">
34 <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>
35 /4 </if>
36 5 <if condition="$show[\'unpurchase\']">
37 <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>
38 /5 </if>
39 3.1 <else />
40 (<a href="mailto:$iteminfo[email]">$iteminfo[email]</a>)
41 /3 </if>
42 /1 </if>
43 </span>
44
45 <if condition="$iteminfo[\'url\']"><a href="$iteminfo[url]" target="_blank">$iteminfo[name]</a><else />$iteminfo[name]</if>
46 </td>
47 <td class="alt2">$iteminfo[price]</td>
48 <td class="alt1">$iteminfo[rating]</td>
49 <td class="alt2">$iteminfo[notes]</td>
50 <td class="alt1">$iteminfo[dateline]</td>
51 </tr>';
52
53 // ###################################################################
54
55 $data2 = '1 <if condition="test"> -0
56 2 <if condition="hi"> -1
57 moo
58 2.1 <else /> -1
59 boo
60 3 <if condition="a"> -2
61 dad
62 3.1 <else /> -2
63 ghost
64 /3 </if> -2
65 /2 </if> -1
66 1.1 <else /> -0
67 hi there
68 4 <if condition="hi"> -1
69 mom
70 4.1 <else /> -1
71 5 <if condition="asdfa"> -2
72 moo
73 5.1 <else /> -2
74 adfds
75 /5 </if> -2
76 /4 </if> -1
77 /1 </if> -0';
78
79 // ###################################################################
80
81 $data3 = 'hey there
82 this is a test
83 <if condition="a">
84 hi
85 <else />
86 booo
87 </if>
88 moo
89 moo
90 moo';
91
92 // ###################################################################
93
94 $parsed = $template->_parse($data2);
95
96 echo '<pre>';
97
98 echo highlight_string('$test = "' . $parsed . '";', true);
99
100 echo '<hr />';
101
102 eval('$test = "' . $parsed . '";');
103
104 ?>