-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathexample-nested-loop.php
73 lines (58 loc) · 1.64 KB
/
example-nested-loop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
// include
require "library/Rain/autoload.php";
// namespace
use Rain\Tpl;
// config
$config = array(
"base_url" => null,
"tpl_dir" => "templates/nested_loop/",
"cache_dir" => "cache/",
"debug" => true // set to false to improve the speed
);
Tpl::configure( $config );
// Add PathReplace plugin
Tpl::registerPlugin( new Tpl\Plugin\PathReplace() );
$user = array(
array(
'name' => 'Jupiter',
'color' => 'yellow',
'orders' => array(
array('order_id' => '123', 'order_name' => 'o1d'),
array('order_id' => '1sn24', 'order_name' => 'o2d')
)
),
array(
'name' => 'Mars',
'color' => 'red',
'orders' => array(
array('order_id' => '3rf22', 'order_name' => '¶©µ¥Aj')
)
),
array(
'name' => 'Empty',
'color' => 'blue',
'orders' => array(
)
),
array(
'name' => 'Earth',
'color' => 'blue',
'orders' => array(
array('order_id' => '2315', 'order_name' => '¶©µ¥15'),
array('order_id' => 'rf2123', 'order_name' => '¶©µ¥215'),
array('order_id' => '0231', 'order_name' => '¶©µ¥315'),
array('order_id' => 'sn09-0fsd', 'order_name' => '¶©µ¥45415')
)
)
);
// draw
$tpl = new Tpl;
$tpl->assign( "user", $user );
echo $tpl->draw( "test" );
class Test{
static public function method( $variable ){
echo "Hi I am a static method, and this is the parameter passed to me: $variable!";
}
}
// end