Re: problem of nesting includes...

From: Date: Sat, 13 Oct 2001 11:20:13 +0000
Subject: Re: problem of nesting includes...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70969@lists.php.net to get a copy of this message
On Thursday 11 October 2001 04:15, Christian Dechery wrote: > We ran a serious thread about "nested includes()" and I saw a lot of > pseudo-solutions... > > and I've just implemented one of them which I think is the best... but > while I was doing it I realised it is more 'pseudo' than I tought... it > worked finally.... but this is what I've figured: > > MAIN INCLUDE PROBLEM: > - if a file "a" includes "b" and "b" includes "c"... > "c" won't have a > path relative to "b"... so it won't work... (unless of course they are > all in the same dir) > > there's no 100% safe solution to work around nested includes with > PHP... right? there's no way you can assure in every file, that > includes another and another (and so on) in different dirs... that it's > allways safe and you won't run into the MAIN INCLUDE PROBLEM.... Um, why not simply set PHP's include_path properly? I'm including files wildly 'round the place and never had any problems with it. > if I had: > /vitrine > /vitrine/adm > /vitrine/include > /vitrine/templates php_value include_dir = .:/xyz/vitrine/adm:/xyz/vitrine/include:/xyz/vitrine/templates You then only have to take care that includes' names/paths relative to these include dirs don't overlap in a harmful way. -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) Install once, run forever. Linux.

« previous php.general (#70969) next »