View helpers for menu
This commit is contained in:
parent
939deb671c
commit
c71a9c49ee
5 changed files with 63 additions and 1 deletions
|
|
@ -14,6 +14,29 @@
|
|||
<module>blog</module>
|
||||
<controller>index</controller>
|
||||
<action>index</action>
|
||||
<pages>
|
||||
<latest>
|
||||
<label>u:latest</label>
|
||||
<route>default</route>
|
||||
<module>blog</module>
|
||||
<controller>index</controller>
|
||||
<action>latest</action>
|
||||
</latest>
|
||||
<archive>
|
||||
<label>u:archive</label>
|
||||
<route>default</route>
|
||||
<module>blog</module>
|
||||
<controller>index</controller>
|
||||
<action>archive</action>
|
||||
</archive>
|
||||
<others>
|
||||
<label>u:readable</label>
|
||||
<route>default</route>
|
||||
<module>blog</module>
|
||||
<controller>index</controller>
|
||||
<action>readable</action>
|
||||
</others>
|
||||
</pages>
|
||||
</blog>
|
||||
|
||||
<portfolio>
|
||||
|
|
|
|||
|
|
@ -22,3 +22,8 @@ ERROR_TXT_WHAT = "Följande har gått fel"
|
|||
class = klass
|
||||
function = funktion
|
||||
line = rad
|
||||
|
||||
|
||||
latest = senaste
|
||||
archive = arkiv
|
||||
readable = läsbart
|
||||
|
|
@ -13,12 +13,15 @@
|
|||
<div id="header"></div>
|
||||
|
||||
<div id="nav">
|
||||
<?=$this->navigation()->menu() ?>
|
||||
<?=$this->renderMenu() ?>
|
||||
<span class="float-right">
|
||||
<a href="<?=$this->url(array('lang' => 'sv')) ?>">sv</a>
|
||||
<a href="<?=$this->url(array('lang' => 'en')) ?>">en</a>
|
||||
</span>
|
||||
</div>
|
||||
<div id="subnav">
|
||||
<?=$this->renderSubMenu() ?>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
|
|
|
|||
16
library/Fiktiv/View/Helper/RenderMenu.php
Normal file
16
library/Fiktiv/View/Helper/RenderMenu.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class Fiktiv_View_Helper_RenderMenu extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function renderMenu()
|
||||
{
|
||||
$active = $this->view->navigation()->menu()->findActive($this->view->navigation()->getContainer());
|
||||
|
||||
if ($active['page']->hasPages()) {
|
||||
return $this->view->navigation()->menu()->setMaxDepth(0)->setUlClass('b')->renderMenu();
|
||||
}
|
||||
|
||||
return $this->view->navigation()->menu()->setMaxDepth(0)->setUlClass('navigation')->renderMenu();
|
||||
}
|
||||
|
||||
}
|
||||
15
library/Fiktiv/View/Helper/RenderSubMenu.php
Normal file
15
library/Fiktiv/View/Helper/RenderSubMenu.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Fiktiv_View_Helper_RenderSubMenu extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function renderSubMenu()
|
||||
{
|
||||
$active = $this->view->navigation()->menu()->findActive($this->view->navigation()->getContainer());
|
||||
|
||||
if ($active['page']->hasPages()) {
|
||||
return $this->view->navigation()->menu()->setUlClass('b')->renderSubMenu();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue