From 6ce2a6c65c9c9eba1e7660d151b6a709ecfa625f Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 10 Nov 2009 12:46:28 +0200 Subject: Fixes, View class --- App.php | 2 -- Controller.php | 6 +++++- README | 4 ++-- View.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 View.php diff --git a/App.php b/App.php index 803aa27..1c45735 100644 --- a/App.php +++ b/App.php @@ -121,8 +121,6 @@ class App static function error($msg) { $err = array('result' => 'error', 'msg' => $msg); - // Send error to client - self::json($msg); // And log it locally self::log($msg); } diff --git a/Controller.php b/Controller.php index 458d3a3..5e14f4b 100644 --- a/Controller.php +++ b/Controller.php @@ -31,7 +31,10 @@ class Controller if ($id) { return $this->get($id); } + + $this->view = new MainView(); return $this; + } /** @@ -349,8 +352,9 @@ class Controller $tpl_contents = ob_get_contents(); ob_end_clean(); + $title = ($this->pageTitle) ? $this->pageTitle : App::conf("defaults.title"); $tpl_contents = preg_replace( - '/.*?<\/title>/', "<title>{$this->pageTitle}", $tpl_contents + '/.*?<\/title>/', "<title>{$title}", $tpl_contents ); echo str_replace('%%page_content%%', $view_contents, $tpl_contents); diff --git a/README b/README index e511e1a..552e770 100644 --- a/README +++ b/README @@ -15,11 +15,11 @@ site: ## index.php ## -A typical index.php using MAIN would look like this: +A typical index.php using Main would look like this: + */ +class MainView +{ + /** + * Create HTML