PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 21st, 2000, 02:31 PM
bfagan bfagan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 2 bfagan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #2  
Old January 24th, 2000, 03:37 AM
PAV PAV is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 1999
Location: Netherlands
Posts: 77 PAV User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Hi Brant,

Did you already try the include() function instead of require?

Peter

[This message has been edited by PAV (edited January 24, 2000).]

Reply With Quote
  #3  
Old January 24th, 2000, 08:10 AM
bfagan bfagan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 2 bfagan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Modular PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT