You are here: Re: [PHP] Prepend policy « PHP « IT news, forums, messages
Re: [PHP] Prepend policy

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация