[thelist] php design question

MarsHall evolt at marsorange.com
Mon Nov 18 16:30:00 CST 2002


On Monday, Nov 18, 2002, at 16:05 US/Central, Tom Dell'Aringa wrote:
> I'm wondering if a) its bad form to have an include within an
> include, and b) if I should be using an include for the get item as I
> am doing below - see code:

If you decide to stick with includes (instead of moving to a class
structure like the other's recommend), then make sure you use
"require_once" instead of "require".

Nesting includes within includes using "requires" can cause nasty
"redefinition of function" errors when files get included more than
once -- using "require_once" prevents those errors, because PHP will
only include each file once (duh!)

Although, I whole-heartedly support the use of classes as recommended
by others. Since I started using them, my code has become much faster
to write, debug, more readable and more reusable!

Mars :)




More information about the thelist mailing list