Native Render

 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
<?php
class View {
protected $data = array();
public function __set ($name, $value) {
$this->data[$name] = $value;
}
public function __get ($name) {
return $this->data[$name];
}
public function display ($name, $data = array()) {
if (is_array($data)) {
foreach ($data as $k => $v) {
$this->__set($k, $v);
}
extract($this->data);
}
include_once VIEW.'/head.phtml';
include_once VIEW.'/'.$name.'.phtml';
include_once VIEW.'/foot.phtml';
}
}