From 50aecb6ca2a07cf94375e1d693e0484bc87fa78d Mon Sep 17 00:00:00 2001 From: Logsol Date: Fri, 19 Jul 2013 16:41:54 +0200 Subject: [PATCH] added page rewrite plugin --- config/defaults.config.ini | 2 +- library/DidgeridooArtwork/Page/Plugin/Page.php | 2 +- .../Local/Controller/Plugin/PageRewrite.php | 18 ++++++++++++++++++ public/index.php | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 library/Local/Controller/Plugin/PageRewrite.php diff --git a/config/defaults.config.ini b/config/defaults.config.ini index 446bcac..e982136 100644 --- a/config/defaults.config.ini +++ b/config/defaults.config.ini @@ -1,4 +1,4 @@ title = Seinheit. subtitle = Praxis für Traditionelle Europäische Medizin email = info@seinheit.ch -#sites = index, event, news \ No newline at end of file +#sites = news, blog \ No newline at end of file diff --git a/library/DidgeridooArtwork/Page/Plugin/Page.php b/library/DidgeridooArtwork/Page/Plugin/Page.php index cfde187..bbc97c3 100644 --- a/library/DidgeridooArtwork/Page/Plugin/Page.php +++ b/library/DidgeridooArtwork/Page/Plugin/Page.php @@ -3,6 +3,6 @@ { public function render($pageName) { - return $this->_view->base . "/page/" . $pageName; + return $this->_view->base . "/" . $pageName; } } \ No newline at end of file diff --git a/library/Local/Controller/Plugin/PageRewrite.php b/library/Local/Controller/Plugin/PageRewrite.php new file mode 100644 index 0000000..f430a68 --- /dev/null +++ b/library/Local/Controller/Plugin/PageRewrite.php @@ -0,0 +1,18 @@ +defaults['sites'])){ + $defaultSites = explode(", ", Katharsis_Registry::getInstance()->defaults['sites']); + } + + $page = Katharsis_Request::getControllerName(); + + if(!in_array($page, $defaultSites)) { + Katharsis_Request::setControllerName('page'); + Katharsis_Request::setActionName($page); + } + } +} \ No newline at end of file diff --git a/public/index.php b/public/index.php index 44dc969..fb2c58c 100644 --- a/public/index.php +++ b/public/index.php @@ -13,6 +13,7 @@ require_once('library/Katharsis/Bootstrap.php'); Katharsis_Autoload::init(); Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Defaults()); +Katharsis_Controller_Plugin::registerPlugin(new Local_Controller_Plugin_PageRewrite()); Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames()); Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession()); Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Notice());