I´ve built a Login Page using Zend_Auth. Now my question ist how can I deactivate areas which are loaded with my layout.phtml?
Here the part of my code of my layout.phtml which I don´t want to see in my login and logout forms:
<div id="navigation">
<ul>
<li><a href="<?php echo $this->url(array('controller'=>'arbeitskalender', 'action'=>'index'), null, false);?>">Arbeitskalender</a></li>
<li><a href="<?php echo $this->url(array('controller'=>'pdf', 'action'=>'index'));?>">Arbeitskalender download</a></li>
<!--<li><a href="<?php echo $this->url(array('controller'=>'bibliothek', 'action'=>'index'));?>">Bibliothek</a></li> -->
<!-- <li><a href="<?php echo $this->url(array('controller'=>'schwestern', 'action'=>'index'));?>">Schwestern</a></li> -->
</ul>
</div>
How can I work with different layouts? In which place and how can I load them?
You can have multiple layouts in an application. If you create another without the navigation HTML and configure it in your module.config.php
, you can simply select which layout to use from within the controller.
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'layout/layout_login' => __DIR__ . '/../view/layout/layout_login.phtml'
)
Then in your controller:
$this->layout('layout/layout_login');
EDIT:
Alternatively if you'd like to dynamically change your layout you can use the Identity View Helper to check whether a user is logged in or not. e.g.
<!-- if logged in, show logout link -->
<?php if (null !== $this->identity()) : ?>
<a href="/logout">Logout</a>
<?php endif; ?>