Make the about-page dynamic by fetching data from db.
This commit is contained in:
parent
c8b44d6345
commit
3bc1f62535
6 changed files with 51 additions and 6 deletions
6
application/models/About.php
Normal file
6
application/models/About.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class About extends Fiktiv_Model_Abstract
|
||||
{
|
||||
|
||||
}
|
||||
22
application/models/Mapper/About.php
Normal file
22
application/models/Mapper/About.php
Normal 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);
|
||||
}
|
||||
}
|
||||
8
application/models/Table/About.php
Normal file
8
application/models/Table/About.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
class Table_About extends Fiktiv_Db_Table_Abstract
|
||||
{
|
||||
protected $_schema = 'fiktivkod';
|
||||
protected $_name = 'about';
|
||||
protected $_primary = 'id';
|
||||
}
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
9
library/Fiktiv/View/Helper/Text.php
Normal file
9
library/Fiktiv/View/Helper/Text.php
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in a new issue