|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am trying to keep common functions in separate files and include/require them at the top of the current script. If I require two files in a script, calling a function from one file from the function in the other file does not work. Each function can be called successfully from the main script. For example:
***main script*** [snip] require "util.inc" // contains print_debug() require "scoreboard.inc" // contains get_scoreboard() From within get_scoreboard(), I cannot print_debug. Any ideas? Thanks. --Brant |
|
#2
|
|||
|
|||
|
Hi Brant,
Did you already try the include() function instead of require? Peter [This message has been edited by PAV (edited January 24, 2000).] |
|
#3
|
|||
|
|||
|
I figured it out. It is a scope problem. In the scoreboard function, I have to add the line:
global $DEBUG; // the global var that tells if priniting should occur. This defines the var and lets the func "see" the print_debug function located in the other file. Now it prints. --Brant |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Modular PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|