Parse errors with includes and/or prepends/appends

From: Date: Tue, 13 Jun 2000 18:49:59 +0000
Subject: Parse errors with includes and/or prepends/appends
Groups: php.general 
Request: Send a blank email to php-general+get-1740@lists.php.net to get a copy of this message
Hello. I'm trying to write a web interface for a management system that relies on session handlers and authentication. I've got a file with all the requisite functions, as well as code snippets that need to go at the top and bottom of every page in this interface system. It seems that php can't handle including only part of a logical block in one file and the other part in a second. When I try and include() or require() the files at the top and bottom of the documents, or use the auto_prepend_file and auto_append_file directives in the apache configuration file, I get parse errors. It seems that the php engine tries to evaluate each seperately. Example: prependfile.inc: <?php session_start(); include("authlib.inc"); // Do some auth checks here if ($AuthFlag == 1) { ?> appendfile.inc <?php } else { include("authform.inc"); } ?> The parse error seems to die on the "if" line in the prepended file. However, if all the code is present on the page (not included/required in), the page works as it should. How can I force the code to be appended/prepended, and then have it evaluated as one unit? Or, am I just missing something obvious here? Seth seth@isis.awc.cc.az.us

« previous php.general (#1740) next »