Hi Jonathon

Thanks for your suggestion.

The secret is to add the new page to the found page and not to the
container (as I was doing previously).

;-)

Jonathan Maron



On Wed, Jun 3, 2009 at 8:29 AM, Jonathon Wallen <jonat...@cub3d.com> wrote:
> You need to 'find' the page within your navigation container first and add
> the pages to that instead of the parent container.
>
> Try using
>
> $parisPage = $navigation->findOneBy('controller','paris');
> $parisPage->addPage($myNewPage);
>
> On 03/06/2009, at 3:39 PM, Jonathan Maron wrote:
>
>> How is it possible to add new navigation pages at a SPECIFIC position
>> in Zend_Navigation_Container?
>>
>> For example, in my bootstrap, I define:
>>
>> /contact/france/paris/ (/module/controller/action)
>>
>> In Contact_FranceController::parisAction() I need to get names of
>> workers from a database and add them to Zend_Navigation_Container,
>> using the addPage() method. The resulting URL should look like this:
>>
>> /contact/france/paris/jim
>>
>> I do this with:
>>
>> $page = new Zend_Navigation_Page_Mvc(array(
>>    'module'     => 'contact',
>>    'controller' => 'france',
>>    'action'     => 'paris',
>>    'params'     => array('person' => 'jim'),
>>    'label'      => 'Sub-Site of Jim',
>>    'title'      => 'Jim'
>> ));
>>
>> $navigation->addPage($page);
>>
>> However, this always adds the new page (with correct URI) to the root
>> of the menu, not in its correct position:
>>
>> - Contact
>> -- France
>> --- Paris
>> ---- Jim
>>
>> How can I add a page at a specific position in Zend_Navigation_Container?
>>
>> I am using ZF 1.8.2.
>>
>> TIA
>>
>> Jonathan Maron
>>
>>
> Jonathon Wallen
>
>

Reply via email to