/ Published in: PHP
                    
                                        
on 2nd thought, if a user logged out from a page only for logged in user, he will see a message stating he needs to login or similar, not ideal ... 
technical implementation:
- use a view helper
- register the helper in bootstrap
- use view helper in view scripts
                technical implementation:
- use a view helper
- register the helper in bootstrap
- use view helper in view scripts
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// view helper
class Application_View_Helper_LogoutLink extends Zend_View_Helper_Abstract {
function logoutLink() {
$returnUrl = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
}
}
// Bootstrap.php
// register your view helper
function _initViewHelpers() {
$this->bootstrap('view');
$view = $this->getResource('view');
$view->addHelperPath('Application\View\Helper', 'Application_View_Helper_');
}
// in your view/layout scripts
echo $this->logoutLink();
// renders something like
// <a href="/auth/logout/?returnUrl=%2Finspiration">Logout</a>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                