1: <?php
2: /**
3: * Pinoco: makes existing static web site dynamic transparently.
4: * Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
5: *
6: * Licensed under The MIT License
7: * Redistributions of files must retain the above copyright notice.
8: *
9: * PHP Version 5
10: *
11: * @author Hisateru Tanaka <tanakahisateru@gmail.com>
12: * @copyright Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
13: * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
14: * @package Pinoco
15: */
16:
17: /**
18: * Default HTML page renderer using native PHP.
19: * @package Pinoco
20: */
21: class Pinoco_NativeRenderer extends Pinoco_Renderer
22: {
23: /**
24: * Renders the web page.
25: *
26: * @param string $page
27: * @param array $extravars
28: * @return void
29: */
30: public function render($page, $extravars=array())
31: {
32: $vars = $this->_sysref->autolocal->toArray();
33: foreach ($extravars as $k=>$v) {
34: $vars[$k] = $v;
35: }
36: $orig_dir = getcwd();
37: chdir($this->_sysref->parentPath($this->_sysref->basedir . "/" . $page));
38: $this->_sysref->updateIncdir();
39: $this->_sysref->_includeWithThis($this->_sysref->basedir . "/" . $page, $vars);
40: chdir($orig_dir);
41: }
42: }
43:
44: