Page 1 of 1

code to run on startup?

Posted: Mon Dec 08, 2008 9:47 pm
by robocop
i have some application-wide code that i am not wanting to have to include on every page...

is there a way to instantiate an "application-wide" class so i dont have to include it on every file that needs it?

thank you!

:RC:

Re: code to run on startup?

Posted: Mon Dec 08, 2008 10:12 pm
by allspiritseve
One possibility is to use mod_rewrite and redirect everything to a single file, usually index.php. This file can then load any other class/file you want. It's a simple implementation of the Front Controller pattern.

Re: code to run on startup?

Posted: Mon Dec 08, 2008 11:11 pm
by josh
It sounds like youre either talking about autoloading or a bootstrap.