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




_________________________________________________________________
Cerca le Parole, gioca su Typectionary!
http://typectionary.it.msn.com/

Reply via email to