FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Problem with FUDforum API global variables (Global variable visibility issue when GLOBALS.php outside global scope)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Problem with FUDforum API global variables [message #161922] Sun, 21 February 2010 03:31 Go to previous message
jlundan is currently offline  jlundan
Messages: 4
Registered: February 2010
Location: Finland
Karma:
Junior Member
Hi,

I just started using the FUDApi and I ran to a small problem. It seems that FUDApi uses a bunch of global variables which are defined in GLOBALS.php and which should be included before using the FUDApi.

The GLOBALS.php expects to be run in global scope because it does not use either global keyword or $GLOBALS array while defining its variables. In other words, GLOBAL.php uses format:

$FUD_OPT_1 = 1737422013;

instead of for example

$GLOBALS['FUD_OPT_1'] = 1737422013;

The problem comes when I try to include the GLOBALS.php from inside a framework, such as CodeIgniter. In these cases my code is already inside a framework class or a method and I cannot go out of it. This means if I include the GLOBALS.php, the variables inside it are no longer global scoped but inside the scope of my framework class/method.

This causes FUDApi to crash with error message like "undefined index 'FUD_OPT_1'. The problem can be solved by modifying the GLOBALS.php to use $GLOBALS array.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Query failed: ERROR: value too long for type character varying(100)
Next Topic: FUDApi - fetch categories
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 13:37:06 GMT 2024

Total time taken to generate the page: 0.08550 seconds