Hello,
Great tips.
Now I feel I am getting started here. I have now setup a $pages array in
Bootstratp _initViewHelpers
What I want to do know is to make several different containers available
to the layout, I do this by:
$container = new Zend_Navigation($pages);
$right = $container->findBy('id', 'right', true);
$view->right = $container->setPages($right);
$container = new Zend_Navigation($pages);
$bottom = $container->findBy('id', 'bottom', true);
$view->bottom = $container->setPages($bottom);
When I render this in layout.phtml, each one of them works fine
<?= $this->navigation($this->right); ?>
or
<?= $this->navigation($this->bottom); ?>
But when I try to render both (in different places) the last one is
rendered twice..
Is there are simple explanation for this?
Regards,
Joakim
Sergio Rinaudo wrote:
Hi,
I advice you to start from here:
http://akrabat.com/zend-framework-tutorial/
If you have to create a class named |'My_Navigation_Page', you must
save it at library/My/Navigation/Page.php, where library is the same
directory where your Zend Framework |dir is saved.
- library
-- Zend
-- My ( you can call it as you like )
-- ThirdParty ( for example )
The second part of your code, this
|$page = Zend_Navigation_Page::factory(array(
'type' => 'My_Navigation_Page',
'label' => 'My custom page',
'foo_bar' => 'foo bar'
));
can be used where you need it, for example in a controller or inside an action
helper.
A 'page' object is used to be added to a container object, then, from a controller, you can
assign the container to the view
$this->view->mymenu = $container;
After this, from your view script, you can use the property you created and
pass it to the navigation view helper:
<?php echo $this->navigation($this->||mymenu||)->menu();?>
|
This is not the best explaination you can have, but I advice you again
to go to the link at the beginning
of this message and download the pdf.
Bye!
Sergio Rinaudo
------------------------------------------------------------------------
Date: Wed, 20 May 2009 22:36:32 +0200
From: [email protected]
To: [email protected]
Subject: [fw-general] Concept of Zend Framework
Hi all,
A really simple question for you guys.
In my effort to learn the framework I run into a lot of examples of
the different components. For example, when reading about the
zend_navigation I see the following,
-----------------
*Example 37.9. Creating a custom page type using the page factory*
To create a custom page type using the factory, use the option |type|
to specify a class name to instantiate.
|
class My_Navigation_Page extends Zend_Navigation_Page
{
protected $_fooBar = 'ok';
public function setFooBar($fooBar)
{
$this->_fooBar = $fooBar;
}
}
$page = Zend_Navigation_Page::factory(array(
'type' => 'My_Navigation_Page',
'label' => 'My custom page',
'foo_bar' => 'foo bar'
));
|
----------------
How do I know where in the project structure this class/file should be
created? All examples are like this and I don't in any case understand
where to create things.
Regards,
Joakim
------------------------------------------------------------------------
Chiamate gratis da PC a PC? Provale da Messenger!
<http://messenger.it/videoconversazioni.aspx>