[web] PHP: Including files messes up relative paths

Started by
10 comments, last by konForce 17 years, 10 months ago
This is pointless discussion.
I agree that using one 'settings.inc.php' is a good way for many tasks. I'm using something like it myself, by the way.
But the point of this topik is to show various methods to include files. :)
Originaly, i've just wrote about __FILE__ constant and showed how to use it in BeanDog's example. Without any refactoring.

And i should say, what is good for one may be bad for other. Changing include path may be good for application, but bad for library (because of possible naming conflicts).
Also think of forum, which has 'settings.inc.php' and CMS which use this forum by including some files from it. If both change include_path than someone will have troubles.
Advertisement
I do agree that special care has to be taken for modules meant to be reused on different websites. I just meant the fixed directory is not necessary in general, but I think it is acceptable for a reusable library like Smarty to use out of convenience.

This topic is closed to new replies.

Advertisement