PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Removing pages

Removing pages can be done with removePage() or removePages(). The first method accepts a an instance of a page, or an integer. The integer corresponds to the order a page has. The latter method will remove all pages in the container.

Example 636. Removing pages from a container

<?php
$container 
= new Zend_Navigation(array(
    array(
        
'label'  => 'Page 1',
        
'action' => 'page1'
    
),
    array(
        
'label'  => 'Page 2',
        
'action' => 'page2',
        
'order'  => 200
    
),
    array(
        
'label'  => 'Page 3',
        
'action' => 'page3'
    
)
));

// remove page by implicit page order
$container->removePage(0);      // removes Page 1

// remove page by instance
$page3 $container->findOneByAction('page3');
$container->removePage($page3); // removes Page 3

// remove page by explicit page order
$container->removePage(200);    // removes Page 2

// remove all pages
$container->removePages();      // removes all pages

Zend Framework