Jason Carson wrote:
How would I go about writing stuff to a file but in between the <?php ?>
Example, say I have config.php as follows...
$hostname = "localhost";
$database = "database";
$username = "username";
$password = "password";
How would I go about adding stuff at the end of the file, but before the
IMHO that's kind of dangerous.
Better to have an xml file -
<hostname value="localhost" />
<database value="database" />
<username value="username" />
<password value="password" />
and read it into a DOM object via DOMDocument.
Then you can add things to the DOM
by making them children of the config node - and write the whole dom
back to file.
That way your web app does not have write permission to a file that gets
executed, and you can potentially cache the DOMDocument object in memory
so it doesn't have to read from file every page load to get your
settings (not tried that yet myself but I don't see why you couldn't).
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php