note 71093 deleted from function.require-once by tularis
| From: | tularis@php.net | Date: | Sun, 12 Nov 2006 14:11:50 +0000 |
| Subject: | note 71093 deleted from function.require-once by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-119625@lists.php.net to get a copy of this message | ||
Note Submitter: rog_per at hotmail dot com
Reason: bad code
----
When including a PHP file in Javascript, the array used by require_once is not updated.
<script language=javascript src="file.php"></script>
This results in a second load of the file at the next require_once:
<?php
require_once("file.php");
?>
How is it possible to tell the PHP require_once or include_once array that it has already been
loaded. For example a new command like...
mark_loaded("file.php");
I only found one solution on the problem, and it was to include a middle-file with the
require_once...
<script language=javascript
src="middle-file.php?file='file.php'"></script>
and here is the middle-file.php
<?php
require_once($GET['file']);
?>
Now the require_once array will be updated!!!!!!
Is there anyone else with another and better solution?