|
Posted by Richard Lynch on 10/04/35 11:07
Sdäv wrote:
> Hey guys, i was wondering if there is any way to make prepend (php.ini
> option) work as an include once and not an STD include.
Well, it's for sure gonna get included once, right?
If you're worried about it getting included again...
I'm not sure of the semantics of:
<?php
include 'foo';
include_once 'foo';
?>
Does it get "regsitered" in the first include?
I guess not, or you'd already be happy, right?
The standard work-around then is to do like this in your included file:
<?php
if (!defined('FILENAME_PHP')){
define ('FILENAME_PHP', 1);
//rest of code here
}
?>
So then you don't really care if it gets included twice, cuz it won't *DO*
anything the second time.
FILENAME_PHP should be a variant of the name of the file being included,
to avoid two files with the same work-around killing each other.
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|