On 6/2/07, pat <[EMAIL PROTECTED]> wrote:
Dear Till,

The Golbal $_App is a special class that automatically loads and saves
application data.  This plug in was actually injecting other stuff into
the template.  I sanitized the plug in, removing site sensitive data
before making it public on the list.  If the ZF has a better way to
persist application data please tell me.

include("app.php");     // include the class
global $_APP;           // contains the application data automatically
saved/loaded
application_start();     // automatically loads data int the global var

Which brings up another thing.  If there is a good reason for not
including a file in this manner ( or any of the other things ), please
say so.  Just winking at me is a bit vague and frankly, somewhat fruity.  ;)

Fruity? Like orangy, or straight banana? ;)

Byte code caching is the keyword - in fact most people who care about
performance run a cache. If you use includes inside classes or
control-flow structures, PHP doesn't know about the included file
until the code is actually run, rendering the cache useless.

__autoload() has the same problem.

Of course it's very convenient!

(I think) That's why e.g. inside the Zend Framework, the developers
never relied on any of those techniques and always include everything
in the beginning of the file. I could be wrong though - better ask
Bill Karwin.

In regard to using globals - well I think the reasons (strictly imo)
are that you can not take the same function and use them in a new
context if it relies on a global from the outside. The global always
needs to be present.

Then bug tracking is a lot harder and then you may have issues a year
or so after you deployed and good luck to you if you remember where
you defined every global and what each of them does - accross all of
your projects.

I also like the idea of scopes and namespaces and globals are - well global. ;)


Cheers,
Till

Reply via email to