Re: Auto Prepend/Append
| From: | chris at improbable dot org | Date: | Thu, 08 Mar 2001 03:22:17 +0000 |
| Subject: | Re: Auto Prepend/Append | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42987@lists.php.net to get a copy of this message | ||
On Tue, Mar 06, 2001 at 12:28:33PM -0600, Boget, Chris wrote:
> > >Is it possible to use the auto prepend/append directives to
> > >prepend/append particular files only to files with a particular
> > >extension?
> > I don't believe you can do this directly with PHP but you
> > probably can with
> > Apache:
> > <Files *.html>
> > php_value prepend_file "foo.php"
> > </Files>
>
> Where do you put this?
> We've tried everywhere, but's not picking up. Are you doing this?
> And it's working?
I just did a simple test using a .htaccess file. foo.php echos "foo"; bar.php
echos "bar".
Without anything in .htaccess, loading foo.php returns "foo" and bar.php
returns "bar".
With php_value auto_prepend_file "bar.php", foo.php returns "barfoo" and
bar.php returns "barbar".
With this:
<Files *.php>
php_value auto_prepend_file "bar.php"
</Files>
foo.php returns "barfoo" and bar.php returns "barbar".
With this:
<Files f*.php>
php_value auto_prepend_file "bar.php"
</Files>
foo.php returns "barfoo" and bar.php returns "bar".
Switching from the .htaccess file to my Apache config file, this produces the same effect as that
last <Files...> directive:
<Location /prep/f*.php>
php_value auto_prepend_file "bar.php"
</Location>
foo.php returns "barfoo", bar.php returns "bar".
Doing the same thing with a <Directory> did not work.