include files with open {
Posted: Fri Sep 22, 2006 6:50 am
Hi.
Here's what I want to try. A lot of pages will need the same statements at the beginning and end, but with different "middles", like this
So what I thought was that I would put the stuff in a header and footer file and include them like
And on the pages that need it include them in the beginning and at the end
But when I tried this I got the following error message
So my question is, is what I'm trying to do even possible, or am I just doing it wrong?
Here's what I want to try. A lot of pages will need the same statements at the beginning and end, but with different "middles", like this
Code: Select all
<?php
/* complete_page.php */
/* header stuff */
SOME STATEMENT
SOME STATEMENT
if(TEST == VALUE){
CONDITIONAL THINGS
}else{
/* page specific */
PAGE STUFF
PAGE STUFF
}
/* footer stuff */
SOME STATEMENTCode: Select all
<?php
/* header.php */
SOME STATEMENT
SOME STATEMENT
if(TEST == VALUE){
CONDITIONAL THINGS
}else{
?>Code: Select all
<?php
/* footer.php */
}
SOME STATEMENT
?>Code: Select all
<?php
/* some_page.php */
include("header.php");
PAGE STUFF
PAGE STUFF
include("footer.php");
?>Code: Select all
Parse error: syntax error, unexpected $end in header.php