37 lines
555 B
PHP
37 lines
555 B
PHP
|
<?php
|
||
|
|
||
|
class View {
|
||
|
|
||
|
private $_template;
|
||
|
private $_view;
|
||
|
private $_data;
|
||
|
|
||
|
private $_block;
|
||
|
|
||
|
public function setTemplate($path) {
|
||
|
$this->_template = $path;
|
||
|
}
|
||
|
|
||
|
public function setView($path) {
|
||
|
$this->_view = $path;
|
||
|
}
|
||
|
|
||
|
public function setData($data) {
|
||
|
$this->_data = $data;
|
||
|
}
|
||
|
|
||
|
public function render() {
|
||
|
$this->_block = $this->_sandbox($this->_view);
|
||
|
return $this->_sandbox($this->_template);
|
||
|
}
|
||
|
|
||
|
private function _sandbox($path) {
|
||
|
ob_clean();
|
||
|
include $path;
|
||
|
$html = ob_get_contents();
|
||
|
ob_clean();
|
||
|
return $html;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|