If statement spaning files
| From: | Meir Kriheli - MKsoft | Date: | Sun, 16 Jul 2000 12:04:02 +0000 |
| Subject: | If statement spaning files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6811@lists.php.net to get a copy of this message | ||
I have a several files which include header.inc at the start
(after setting some vars), and footer.inc at the end of the page.
I want to start an if statment at header.inc and close it
at footer.inc.
something like
body.php
-----------
<?
set some vars...
include ('header.inc');
......
......
......
include('footer.inc')
?>
header.inc
-----------
<?
if (condition) {
?>
footer.inc
-----------
<?
}
else {
.......
}
?>
But that gives my syntax error in header.inc. From this i guess
that included files are parsed as a whole before inserting them into
the page. Is this correct ?
Is there another solution (require ?), or do I have to put the condition
on each page (I'd hate to do this)
Thank you
Meir Kriheli
MKsoft computer systems
'There's someone in my head but it's not me" - Pink Floyd