|
Posted by Steve on 09/18/07 13:10
"NoDude" <nodude@gmail.com> wrote in message
news:1190120352.199784.74770@y42g2000hsy.googlegroups.com...
> Ahem... I have a feeling I'll get shot, stabbed and hung for this,
> buuuuuut... There's really no need for require_once in __autoload,
> because if you've reached the __autoload function, the class is
> obviously not present (no sense making php check for it a second
> time). Also, if you're including from the same directory, use './'.
> $class_name.'.php', that way php won't look in the includes paths.
not shot. ;^)
it is best not to assume *anything* in programming, but be explicit all the
time. i use a config file that gets included in *every* script i write.
guess what? each script gets required once...anyway, i digress. that config
file objectifies my site's properties including path information
(site::includeDirectory)...that avoids many problems like not having to keep
the same directory structure when released to a different server and having
to reprogram for the new env. it also eliminates the problem you mention
with traversing include paths. other benefits too, but the main one being
one location to manage paths without being tied to relativism.
that's just my 0.02 usd.
Navigation:
[Reply to this message]
|