note 11975 modified in control-structures.php by jmcastagnetto

From: Date: Fri, 16 Mar 2001 03:00:50 +0000
Subject: note 11975 modified in control-structures.php by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-12457@lists.php.net to get a copy of this message
[Editor's note: This is clearly discussed in the manual: "Appendix B. Migrating from PHP 3.0 to PHP 4.0". Reading that appendix would've helped a lot.] It would appear that PHP4 does not allow a control structure to open in one included file and close in another. Perhaps it was a terrible idea, but I had a set of pages that included "include/start-page.php3" at the beginning of the page and "include/end-page.php3" at the end. Among other things, start-page.php3 basically had the following code at the end of the file:<p> if (the user isn't logged in) { display_login_form(); } else { ?><p> and the end-page.php3 file began with the right curly bracket that would end that block of logic. This way, I could create a bunch of pages that looked like this:<p> include "include/start-page.php3"; include "all-the-content.php3"; include "include/end-page.php3";<p> and if the user was not logged in, they'd see only a login form and no other content. This worked just fine until I upgraded to php4, which produces parse errors when the logic block in an included file doesn't conclude before EOF. Looks like maybe I'll have to set a variable and test for it all over the place. http://www.php.net/manual/control-structures.php.php

« previous php.notes (#12457) next »