2010年12月3日星期五

Re: [fw-mvc] Where are the module bootstraps objets saved?

-- Marko78 <marko.korhonen@gmail.com> wrote
(on Thursday, 02 December 2010, 11:38 AM -0800):
>
> So I can get them and use their methods from anywhere?

Yes, absolutely.

The bootstrap object has references to them, and if you have the
bootstrap object, you call "getResource($name)" to grab the resource:

$view = $bootstrap->getResource('view');

The bootstrap object is injected into the front controller as a
parameter, which makes it available in your action controllers:

$bootstrap = $this->getInvokeArg('bootstrap');

Elsewhere, you can grab it from the front controller singleton:

$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Re: [fw-mvc] Where are the module bootstraps objets saved?

I always wondered this.
I ended up extending Zend_Application and making My_Application a singleton, then whenever I need a resource,
$app = My_Application::getInstance();
if($app->hasPluginResource('foo')) {
$foo = $app->getPluginResource('foo');
$foo->getSomething();
}
I don't know if that's evil/bad practice though... It probably is!

On 2 Dec 2010, at 19:38, Marko78 wrote:

>
> So I can get them and use their methods from anywhere?
>
> br, Marko
>
> -----
> br,
> --------------------------
> Marko Korhonen
> Technical Consultant
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3070011.html
> Sent from the Zend MVC mailing list archive at Nabble.com.

2010年12月2日星期四

[fw-mvc] Re: Use ob_gzhandler with ZF

Ok, forgive me for digging up an ancient thread here, and for heading
slightly off-topic (although I am trying to shoe-horn this stuff into a ZF
context):

So, this looks to be basics of the de-facto (apache.org) recommended
mod_deflate .htaccess setup:

AddOutputFilterByType DEFLATE text/html
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

But, my question is, do we even need the BrowserMatch stuff here, and the
adding of 'User-Agent' to the 'Vary' header (which in itself must cause huge
potential-for-caching inefficiency for proxies/network-level-caches)??

Seems all they're doing is saying "don't gzip for old Mozilla 4.0 browsers,
unless they're actually IE". But are any of these non-IE old Mozilla 4.0
browsers still in widespread use, even in the slightest? Is Opera fully gzip
friendly?

Also, what's the deal with the rumoured don't-like-gzip errors with certain
versions of IE 6.0 that occur intermittently? These rules don't seem to care
what IE version it is, so are there any real issues? And what about IE <=
5.5? Not that anyone even makes their sites work in such antiques these
days!

What I'm asking, in a nutshell, is why can't I just do this:

AddOutputFilterByType DEFLATE text/html

..and let mod_deflate automatically take care of choosing whether to gzip
based solely on the 'Accept-Encoding' header, and automatically adding
'Vary: Accept-Encoding' if it gzips?

Jonny
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Use-ob-gzhandler-with-ZF-tp668519p3070122.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Where are the module bootstraps objets saved?

So I can get them and use their methods from anywhere?

br, Marko

-----
br,
--------------------------
Marko Korhonen
Technical Consultant
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Where-are-the-module-bootstraps-objets-saved-tp3070011p3070011.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2010年12月1日星期三

Re: [fw-mvc] Bootstrap init function

Hi Gary,

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.
> >
>

Re: [fw-mvc] Bootstrap init function

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.
>

[fw-mvc] Bootstrap init function

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.