PHP: splitting a loop into separate include files
So here's the model: 3 files. First file starts a loop. Second file has some loop content. Third file closes the loop.
The files are so:
test.php:
test_header.php:
test_footer.php:
PHP complains:
[Thu May 29 01:04:00 2008] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected $end in R:\\html\\armenianreporter\\test_header.p hp on line 4
Line 4 is the one that closes the script in that file ("?>")
So the question is: Can this actually be done? If so, how? Do you know where in the PHP manual this is discussed?
The files are so:
test.php:
<?php
include $_SERVER["DOCUMENT_ROOT"]."/test_header.p hp";
echo "hello";
include $_SERVER["DOCUMENT_ROOT"]."/test_footer.p hp";
?>
include $_SERVER["DOCUMENT_ROOT"]."/test_header.p
echo "hello";
include $_SERVER["DOCUMENT_ROOT"]."/test_footer.p
?>
test_header.php:
<?php
$cond = true;
while($cond) {
?>
$cond = true;
while($cond) {
?>
test_footer.php:
<?php
$cond = false;
}
?>
$cond = false;
}
?>
PHP complains:
[Thu May 29 01:04:00 2008] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected $end in R:\\html\\armenianreporter\\test_header.p
Line 4 is the one that closes the script in that file ("?>")
So the question is: Can this actually be done? If so, how? Do you know where in the PHP manual this is discussed?
