Re: Prepend policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux