Using function in PHP script n DOCROOT in PHP script in subfolder

From: Date: Sat, 11 May 2002 00:01:46 +0000
Subject: Using function in PHP script n DOCROOT in PHP script in subfolder
Groups: php.general 
Request: Send a blank email to php-general+get-97040@lists.php.net to get a copy of this message
<? // This function is the PHP version of the TCL proc PRODUCE_MENUBAR which // will produce the menubar for all PHP files // // Syntax: echo PRODUCE_MENUBAR() // function PRODUCE_MENUBAR() { global $HTTP_HOST; $tcl = (preg_match("/\bdyndns\b/i", $HTTP_HOST)) ? "tclsh83" : "tclsh"; $path = (preg_match("/\bdyndns\b/i", $HTTP_HOST)) ? "cgi-bin" : "cgi-bin/cgiwrap/ppowell"; $fileID = fopen("http://$HTTP_HOST/$path/menubar.cgi", "r"); $menubar = fread($fileID, 1000000); fclose($fileID); return $menubar; } ?> This function exists in the file "menubar_functions.php" which is in the docroot. I have a PHP script in a subfolder /chat that produces a Fatal Error (call to undefined function PRODUCE_MENUBAR()) each time it tries to find it. How do I fix this problem? I do not want to duplicate the PHP script per folder as there will be an enormous amount of dynamically-created subfolders and I will have to copy a version per folder. I want to be able to use the one PHP script in the DOCROOT for every PHP script in every subfolder, how is this done? Thanx Phil

« previous php.general (#97040) next »