Here is what I am doing:
index.php:
<?php
require('config.php');
echo head($title);
echo body($content);
?>
config.php:
<?php
// *DB login*
// *Fetch settings*
$GLOBALS[sitename] = $fromDB;
$GLOBALS[slogan] = $fromDB;
// *etc.*
include('html.php');
?>
html.php
<?php
function head($title) {
// *Code that needs to use stuff from $GLOBALS*
}
function body($content) {
// *Code that needs to use stuff from $GLOBALS*
}
?>
My problem is that the $GLOBALS don't seem to be accessible in html.php. I have tried adding "echo $GLOBALS[sitename];" to index.php, but they don't seem to be set there either. Even if I put that line into config.php it doesn't work!!
The "$GLOBALS[x] = $y;" lines are inside a while loop, but not a function.
Why aren't the $GLOBALS being set?
Isaac
PS. I think I have quite an extensive knowledge of PHP except for variable scope and (especially) classes (hint, hint!).
PPS. I haven't posted on PHPBuilder for ages so my explaining skills may have deteriorated (I used to post so often that I got quite good!) - please let me know if I am not being very clear!