Archived
1
0
Fork 0

Make the about-page dynamic by fetching data from db.

This commit is contained in:
Henrik Hautakoski 2010-11-16 19:12:45 +01:00
parent c8b44d6345
commit 3bc1f62535
6 changed files with 51 additions and 6 deletions

View file

@ -0,0 +1,6 @@
<?php
class About extends Fiktiv_Model_Abstract
{
}

View file

@ -0,0 +1,22 @@
<?php
class Mapper_About extends Fiktiv_Model_Mapper_DbTableAbstract
{
public function getContent($locale = null)
{
if ($locale === null) {
$locale = 'se';
}
//$ad = new Zend_Db_Adapter_Abstract();
//$ad->fet
$adapter = $this->_dbTable->getAdapter();
$select = $adapter
->select()
->from('About', array('Title', 'Content'))
->where('Locale = ?', $locale);
return $adapter->fetchPairs($select);
}
}

View file

@ -0,0 +1,8 @@
<?php
class Table_About extends Fiktiv_Db_Table_Abstract
{
protected $_schema = 'fiktivkod';
protected $_name = 'about';
protected $_primary = 'id';
}

View file

@ -23,7 +23,9 @@ class IndexController extends Fiktiv_Controller_Action
public function aboutAction()
{
$lang = Zend_Registry::get('Zend_Translate')->getLocale();
$this->view->content = $this->dataService->About->getContent($lang);
}
public function test()

View file

@ -1,17 +1,15 @@
<a href="#" name="about"></a>
<h2><?=$this->translate('uw:about') ?></h2>
<br />
<p><?=$this->translate('ABOUT_TXT') ?></p>
<p><?=$this->text($this->content['about'])?></p>
<a href="#" name="bts"></a>
<h2><?=$this->translate('uw:behind the site') ?></h2>
<br />
<p><?=$this->translate('ABOUT_TXT_BTS') ?></p>
<p><?=$this->text($this->content['behind the site'])?></p>
<a href="#" name="cookies"></a>
<h2><?=$this->translate('uw:cookies') ?></h2>
<br />
<p><?=$this->translate('ABOUT_TXT_COOKIES') ?></p>
<p><?=$this->text($this->content['cookies']) ?></p>

View file

@ -0,0 +1,9 @@
<?php
class Fiktiv_View_Helper_Text extends Zend_View_Helper_Abstract
{
public function text($string)
{
return nl2br($this->view->escape($string), $this->view->doctype()->isXhtml());
}
}