> Hi, > > I'm having troubles accessing the global variables. From my understanding > of PHP, when you declare a variable 'global' it is no longer just in the > local scope, but becomes known in the global scope of the program. > > In file, 'layout.php' ... > function top_sidebar_header() { > global $g_graphic; > echo $g_graphic; > } > > In file, 'body.php' ... > include_once( $GLOBALS["DOCUMENT_ROOT"] . "/include/layout.php" ); > top_sidebar_header(); // function is called, but when "echo > $g_graphic" is executed, > // nothing prints out because > $g_graphic is empty or "" > > In file, 'about/index.php' ... > $g_graphic = "/media/image.jpg"; > include_once( $GLOBALS["DOCUMENT_ROOT"] . "/body.php" ); > > Have I overlooked something crucial? > > I haven't been able to find much documentation on this topic. (Please keep > in mind that I am also a newbie at PHP. :) ) ~ It'd be really great if any > of you have suggestions on this. > > Thanks in advance, > Adelaide >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php