Reputation: 88187
With Zend_Navigation, I can do something like
Home > Projects > Collaborators
but What if I want something more useful
Home > Project name > Collaborator name
How can I acheive this? Is it a good idea? Possibly, there would be performance issues? Cos it got to query up the hierarchy? But whatever it is, how can I achieve this?
Upvotes: 1
Views: 7258
Reputation: 621
Maybe it's a little bit late, but since I've been struggling with this, I'm posting it just in case it can help anyone.
If you just want to change the actual label of the current page, the easiest way to do it is in this way:
$this->view->navigation()->findOneByRoute(
Zend_Controller_Front::getInstance()
->getRouter()
->getCurrentRouteName()
)
->setLabel($label);
The findOneByRoute will work charmly if you use Zend_Routes, if you don't, you can change it by findOneByX, being X is any property of the page.
Answering to the question of the OP, in this case, it would be easy to do:
$this->view->navigation()->findOneByLabel('Collaborators')
->setLabel('Collaborator'. $name);
Being $name, the name of the collaborator.
I hope this helps to those people that still use ZF1.
Greetings,
Upvotes: 1
Reputation: 50638
The easiest way is to render the breadcrumbs and then append to this string the Collaborator name.
This works unless you don't need it in the navigation or sitemap. Otherwise, you have to add it to the container manually.
$this->navigation()
->getContainer()
->findOneByLabel('Colaborators')
->addPage(array('label'=>'name', 'uri'=>'/name'));
Upvotes: 2
Reputation: 5947
Example #34 shows you how to use a view partial for breadcrumbs. I'd do a foreach
on $this->pages
and adjust where needed
Upvotes: 4