Global Constants

From: Date: Thu, 28 Sep 2000 00:49:15 +0000
Subject: Global Constants
Groups: php.general 
Request: Send a blank email to php-general+get-17831@lists.php.net to get a copy of this message
I've found that I can incorporate several different <script> fragments throughout a phtml file. I use this approach to output OS- and browser- specific <style> tags in the <head>, and then do data processing in certain <div>'s but not others. However, when I do this, I run into the "duplicate include" problem. I thought I could solve this by defining constants in the first few lines of each include'd file, but that doesn't work. To be specific, file dbclass.php <script language="php"> $include_flag = "INCLUDE" . basename(__FILE__); if( defined($include_flag) ) { return TRUE; } define($include_flag, TRUE); ... rest of dbclass.php file main phtml file: ... <div class="one"> ... <script language="php"> include("dbclass.php"); ... </script> </div> ... <div class="two"> ... <script language="php"> include("dbclass.php"); <----- error generated; duplicate include Apparently, the defined constants don't "survive" from one <script> to the next. Does anyone know of a solution to this problem? Other than (a) not having separate <scrip> fragments or (b) just commenting out the second include() [that's what I'm doing now, but I'd like to avoid it because it introduces a dependency into the code]. Thanx in advance for any help or advice! - Mark mark@REMOVETHIS STUFF@arcabama.com

« previous php.general (#17831) next »