From 3bc1f62535b4079e59d5a62fd0b91eded4e7de29 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 16 Nov 2010 19:12:45 +0100 Subject: [PATCH] Make the about-page dynamic by fetching data from db. --- application/models/About.php | 6 +++++ application/models/Mapper/About.php | 22 +++++++++++++++++++ application/models/Table/About.php | 8 +++++++ .../default/controllers/IndexController.php | 2 ++ .../default/views/scripts/index/about.phtml | 10 ++++----- library/Fiktiv/View/Helper/Text.php | 9 ++++++++ 6 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 application/models/About.php create mode 100644 application/models/Mapper/About.php create mode 100644 application/models/Table/About.php create mode 100644 library/Fiktiv/View/Helper/Text.php diff --git a/application/models/About.php b/application/models/About.php new file mode 100644 index 0000000..88e2986 --- /dev/null +++ b/application/models/About.php @@ -0,0 +1,6 @@ +fet + $adapter = $this->_dbTable->getAdapter(); + + $select = $adapter + ->select() + ->from('About', array('Title', 'Content')) + ->where('Locale = ?', $locale); + + return $adapter->fetchPairs($select); + } +} \ No newline at end of file diff --git a/application/models/Table/About.php b/application/models/Table/About.php new file mode 100644 index 0000000..201c831 --- /dev/null +++ b/application/models/Table/About.php @@ -0,0 +1,8 @@ +getLocale(); + $this->view->content = $this->dataService->About->getContent($lang); } public function test() diff --git a/application/modules/default/views/scripts/index/about.phtml b/application/modules/default/views/scripts/index/about.phtml index f218b7f..6d73215 100644 --- a/application/modules/default/views/scripts/index/about.phtml +++ b/application/modules/default/views/scripts/index/about.phtml @@ -1,17 +1,15 @@ +

translate('uw:about') ?>


-

translate('ABOUT_TXT') ?>

- - +

text($this->content['about'])?>

translate('uw:behind the site') ?>


-

translate('ABOUT_TXT_BTS') ?>

- +

text($this->content['behind the site'])?>

translate('uw:cookies') ?>


-

translate('ABOUT_TXT_COOKIES') ?>

\ No newline at end of file +

text($this->content['cookies']) ?>

\ No newline at end of file diff --git a/library/Fiktiv/View/Helper/Text.php b/library/Fiktiv/View/Helper/Text.php new file mode 100644 index 0000000..885980c --- /dev/null +++ b/library/Fiktiv/View/Helper/Text.php @@ -0,0 +1,9 @@ +view->escape($string), $this->view->doctype()->isXhtml()); + } +}