thats not entirely true, all functions in a bootstrap class that name
starts with "_init" are bootstrapped automatically (when calling bootstrap()
on a Zend_Application object).
You can also pass a parameter to the bootstrap method to explicitly call an
initialize method (or methods passing an array). For example..
$application->bootstrap('cli');
will only run the bootstrap function _initCli().
This is ideal for running your application and limiting what's required
based on the environment its running in. For example if your running a
Zend_Tool or Cli script you typically wouldn't want to start up routes and
begin dispatching a front controller.
I normally have..
_initFront();
_initCli()
_initMail();
_initTest();
I'm sure there are other cases you'd possibly require but to date this has
sufficed for me.
$application->bootstrap(); // will run all methods starting with
"_init".
Other useful functions can be added to the bootstrap class, but avoid
prefixing them with "_init" unless you want them to run on bootstrapping of
the application.
Lee
On Wed, Dec 1, 2010 at 10:19 AM, Gary Hockin <gary@garyhockin.co.uk> wrote:
> Hi Gianni,
>
> All functions in the bootstrap class are called during the bootstrap part
> of
> the dispatch process process.
>
> Gary/Spabby
>
> On 1 December 2010 10:13, gianni.valenti@alkeria <
> gianni.valenti@alkeria.com
> > wrote:
>
> >
> > Dear all,
> >
> > I'm still learning the Zend Framework, therefore please excuse me if my
> > question is too simple.
> >
> >
> > I just red the
> >
> http://framework.zend.com/manual/en/learning.view.placeholders.basics.html
> > Basic Placeholder Usage page in the documentation, but I didn't
> understand
> > when the method _initSidebar() in the Bootstrap class is called and by
> who.
> >
> >
> > Can someone give me a clue?
> >
> >
> > Thanks a lot,
> >
> > Gianni
> >
> > --
> > View this message in context:
> >
> http://zend-framework-community.634137.n4.nabble.com/Bootstrap-init-function-tp3066968p3066968.html
> > Sent from the Zend MVC mailing list archive at Nabble.com.
> >
>
没有评论:
发表评论