2010年3月10日星期三

[fw-mvc] Re: Zend_Navigation noob question

You should add Zend_Navigation to your view:

$view = Zend_Layout::getMvcInstance()->getView();
$view->navigation($navigation);

Laura Dean wrote:
>
> It seems like between Jon Lebensold's Zendcast and the ZF docs I should be
> able to figure out how to set up Zend_Navigation, but I am still missing
> something...
>
> Is there a way to set it up without using the bootstrap.php file? I have
> the following in my init.php:
>
> /**
> * Layout helper
> */
> Zend_Layout::startMvc();
>
> /**
> * Navigation helper
> */
> $xml = new Zend_Config_Xml($config->framework->config_dir .
> '/navigation.xml', 'nav');
> $navigation = new Zend_Navigation($xml);
>
> And in my layout.phtml, I want to display it using this:
>
> <? $this->navigation()->menu(); ?>
>
> So it looks like the part I am missing is how to add "$navigation" to the
> view, but the view variable isn't currently used anywhere in index.php and
> I'm just not sure how it gets initialized or if I have access to it from
> there.
>
> I also don't understand how I need to modify my index.php to load the
> "_init" functions from bootstrap.php. I assume it will look like
> $bootstrap = something ... but I'm not sure what that something is and I'm
> having a hard time finding it for some reason.
>
>

--
View this message in context: http://n4.nabble.com/Zend-Navigation-noob-question-tp1583090p1587612.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: