Re: problem of nesting includes...

From: Date: Sun, 14 Oct 2001 15:53:54 +0000
Subject: Re: problem of nesting includes...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-71035@lists.php.net to get a copy of this message
At 13:20 13/10/2001 +0200, Christian Reiniger wrote:
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.
what if I don't have permissions to change any configs in PHP??? It doesn't sound like a great solution.... one should be able to include() without having to alter any server settings... in my case, I run the server, so there's no prob... but what if someone installs my script on a webhost that doesn't allow .htaccess, runs PHP in safe-mode and all that? how would we solve the 'nested include()' problem? It has to be 100% generic, or it's not a solution... _____________________________ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br

« previous php.general (#71035) next »