template == null) { $this->template = strtolower(get_class($this)); } ob_start(); include('templates/' . $this->template . '.php'); $data = ob_get_contents(); ob_end_clean(); return new HTTPResponse($data); } public function child($name) { $method = sprintf("child_%s", $name); if(method_exists($this, $method)) { return call_user_func(array($this, $method)); } else { return new FileNotFound(); } } // trailing slash public function child_() { if($this->addSlash) { return $this; } else { return new FileNotFound(); } } } class Redirector extends Resource { private $url; private $status; public function __construct($url, $status=302) { $this->url = $url; $this->status = $status; } public function render($req) { $response = new HTTPResponse('', $this->status); $response->addHeader('Location', $this->url); return $response; } } ?>