Inside application/views/helpers : (Navigation.php)

<?php

class Zend_View_Helper_Navigation extends Zend_View_Helper_Abstract {

    public function navigation() {

        // If this is the layout for AdminController

            // return $this->view->render('admin_nav.phtml');

        // else

            return $this->view->render('main_nav.phtml');

    }

}

layout.phtml :

<?= $this->navigation() . "\n"; ?>

The above displays 'main_nav.phtml' ( this file is in the layouts
directory).

Am I write to put a conditional statement inside Navigation.php in an
attempt to determine if AdminController has been called, then display a
different navigation file?

I think I may be on the right track, but there is something about what I
have done that just doesn't seem right.

Thanks in advance.

Jason

Jason DEBORD
Limoges, France


On Sun, Feb 15, 2009 at 5:23 PM, Jason DeBord <[email protected]> wrote:

> I would like to set a placeholder for site navigation just like <?=
> $this->layout()->content ?>
>
> 1. How?
>
> 2. Just as, if not more importantly, I would like a 
> *default*"navigation.phtml" to be rendered by <?= $this->layout()->nav ?> and 
> have
> the ability to over ride it on the Controller level. For example, every
> Controller *except* AdminController gets "main_nav.phtml". AdminController
> gets "admin_nav.phtml ". Other than the navigation, the layout stays the
> same.
>
> Thanks!
>
> Jason DEBORD
> Limoges, France
>
>

Reply via email to