Date: 09/27/00
- Next message: David Robley: "RE: [PHP] select case **"
- Previous message: Dan: "RE: [PHP] Large e-commerce PHP site?"
- In reply to: Mark Olbert: "[PHP] Global Constants"
- Next in thread: Mark Olbert: "RE: [PHP] Global Constants"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark-
Subject: Re: [PHP] Global Constants
This is what I do, and it works for me:
<?php
if ( ! defined (INCLUDE_FILENAME) ) :
define (INCLUDE_FILENAME, 1);
[contents of file go here]
endif;
?>
Two differences between mine and yours. One, I use the <?php ?>
tags instead of the <script></script> tags. Two, I'm ifdef'ing
out the entire contents of the file, you're trying to call
return after checking the include flag.
Some debugging thoughts. Have you tried including a file twice
within the same section of code? Have you tried an include file
that just echoes it's filename?
-mike
On Wed, 27 Sep 2000, Mark Olbert wrote:
>
> <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 <email protected> STUFF <email protected>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>
--"don't you know about the new fashion, honey? all you need are looks and a whole lotta money" -- billy joel
GnuPG key available at http://devel.duluoz.net/pubkey.asc Key ID = 1024D/9A256AE5 1999-11-13 Mike Glover <mpg4 <email protected>> Key fingerprint = EF6E 8BCB 4810 E98C F0FD 4596 367A 32B7 9A25 6AE5
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: David Robley: "RE: [PHP] select case **"
- Previous message: Dan: "RE: [PHP] Large e-commerce PHP site?"
- In reply to: Mark Olbert: "[PHP] Global Constants"
- Next in thread: Mark Olbert: "RE: [PHP] Global Constants"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

