RE: [PHP] auto_prepend_file question
| From: | Myke Hines | Date: | Tue, 14 Nov 2000 21:45:55 +0000 |
| Subject: | RE: [PHP] auto_prepend_file question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25252@lists.php.net to get a copy of this message | ||
No he is talking about PHP prepend/append feature. Bascially during compile
you can tell PHP to include a file both before and after any script is run.
This could be to automatically create a db connection, etc without any
modification to the scripts. When you use this its just like php in
throwing an 'include <file>' in every script, at least thats how it acts.
So what he described initially should work. Make sure your not doing things
in functions and might have to declare the variable global.
hope this helps
myke
-----Original Message-----
From: The Captain [mailto:rob@siliconcarne.net]
Sent: Tuesday, November 14, 2000 1:20 PM
To: Ed Lazor; php-general@lists.php.net
Subject: Re: [PHP] auto_prepend_file question
I'm not sure i understand? Are you including prepend.php in your index.php
file? You'll need the "require()" function for that.
I created two files and it seemed to work fine for me:
PREPEND.PHP:
<?
$Message = "testing...";
?>
and INDEX.PHP:
<?
require "./prepend.php";
print $Message;
?>
Give that a try.
on 11/14/00 4:14 PM, Ed Lazor at osmosis@atfantasy.com wrote:
> If I prepend a file and define a variable in it, I should be able to
access
> that variable in index.php, right?
>
> So, if the prepend.php file has this:
>
> $Message = "This is a test<br>";
>
> And then index.php has this:
>
> print $Message;
>
> I should end up with with the following text on my web browser when I load
> the page:
>
> This is a test
>
> Right? At least, that's the way I thought it worked, but it's not working
> for some reason and I'm trying to figure out what the problem is.
>
> Thanks,
>
> -Ed
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net