code to run on startup?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
robocop
Forum Newbie
Posts: 3
Joined: Tue Oct 28, 2008 11:02 am

code to run on startup?

Post 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:
User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Re: code to run on startup?

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: code to run on startup?

Post by josh »

It sounds like youre either talking about autoloading or a bootstrap.
Post Reply