I know the title is vague, but the details for this particular question would make the title absurd.
I have an index.php
file that has a virtual include within it:
<!--#include virtual="/includes/header.include"-->
This header.include
file is HTML
and I want to add a few lines of PHP
inside of it.
My .htaccess
file is set up to process .include
files as php. The actual line from the .htaccess
file is:
AddType application/x-httpd-php .include
The PHP
that I'm trying to add is:
<?php echo "test <br />"; ?>
But when I load the website, the only thing that prints is:
"; ?>
If I view the source of the index.php
I can see the entire PHP
code that I have above.
Some other things I've already tried:
- Copy the
.htaccess
file into the directory that theheader.include
file is in - Both the accepted answer and the answer with 6 upvotes from this question
- Tried
<br>
instead of<br />
What am I doing wrong? Why won't the PHP
get parsed correctly?
My PHP
version is 5.1.6
instead of
is not correct. Rather the
tag can be self closed (rather that having a second tag ) the correct format is
<== note the space before the '/' Why make the include 'virtual' when a simple BTW: is that includes sub directory really at the file system root? probably not, so a better line might be: rename the file to header.php then include it with: – user3629249 May 23 '14 at 00:05
also doesn't work – CheeseConQueso May 23 '14 at 10:17