Forum Search:
FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.
Calendar
Search
Help
Members
Control Panel
Logout [ CommonCrawl [Bot] ]
Home
Post Form
Logged in user:
CommonCrawl [Bot] [
logout
]
Forum:
Bug Reports
Title:
Poll:
[CREATE POLL]
Message Icon:
No Icon
Smiley Shortcuts:
[
list all smilies
]
Formatting Tools:
Size
1
2
3
4
5
6
7
Color
Sky Blue
Royal Blue
Blue
Dark Blue
Orange
Orange Red
Crimson
Red
Firebrick
Dark Red
Green
Lime Green
Sea Green
Deep Pink
Tomato
Coral
Purple
Indigo
Burly Wood
Sandy Brown
Sienna
Chocolate
Teal
Silver
Font
Arial
Times
Courier
Century
Body:
Forum Options:
HTML
code is
off
BBcode
is
on
Images
are
on
Smilies
are
on
Editing Time Limit
: Unlimited
[quote title=Dayo wrote on Sat, 30 April 2011 04:39][quote title=Quote:]From the bottom of my heart I do not mean any offense[/quote] No offense taken at all and I hope none is given by my posts as well. [quote title=Quote:]If that makes sense?[/quote] It does, 100% ... and makes my point as well which perhaps I have not been able to explain clearly enough. I know what the variable scope is and what needs to be done with respect to this. My point is precisely that putting items that will not change during the lifetime of the request into variables and then having to do the scope shuffle is a structural weakness or to put it bluntly, the result of a poor design choice. All the variables in GLOBALS.php should have been either: 1. Declared explicitly as "GLOBALS['XYZ']" and always referenced as "GLOBALS['XYZ']". In this way, they will always be in the global scope wherever GLOBALS.php is included and since they are always referenced as such, in the situation I described earlier, I wouldn't need to be declaring globals this and globals that in my function. At present I have to declare "globals Every, Single, Variable, In, GLOBALS, Dot, PHP, One, By, One" or at least "globals Every, Single, Variable, In, GLOBALS, Dot, PHP, Used, In, The, Functions, I, Need, One, By, One" which is not good. 2. Defined as constants. The values are not going to change so why put them in variables instead of constants and then start doing the scope shuffle? If GLOBALS.php had contained "define('CONFIG_XYZ', 'abc')", whenever you need the value, all you do is use "CONFIG_XYZ" and that will be that. 3. Make it a class. Include and refer to class variables However, you have chosen to do it the way it is now and of course I realise that the way it is currently set up makes no big difference internally within the application since you just use "$XYZ" or "GLOBALS['XYZ']" as required, but the reality is that if you had been delibrately trying to make the application unfriendly and difficult to extend/integrate, you couldn't have done a better job. This loose structure fills every aspect of the code I have looked at. There are functions that appear as many times as the number of themes plus one. Grep one of the the functions db.inc and you will find it appearing multiple times in different places. This is bad, bad, bad ... but I don't want to go there now and just hope what I am saying about the GLOBALS.php thing is understood at this point.[/quote]
File Attachments:
Allowed File Extensions:
jpg jpeg png gif txt doc gz bz2 inc php zip diff
Maximum File Size:
1024KB
Maximum Files Per Message:
5
Options:
Post Notification
Notify me when someone replies to this message.
Include Signature
Include your profile signature.
Disable smilies in this message
Topic View
Post by Dayo is ignored
Re: GLOBALS.php "Bug"??
Thu, 28 April 2011 09:20
Ernesto
Karma:
If you include something in a function, the result will be local unless specifically defined as global within the function.
So if you include the file outside the function, it will be global or "public" using .NET terminology.
If you want to be able to access a local variable outside the parent function you have to declare it global or supergloba, either by declaring it within the global scope, or defining it as global within the function.
If that makes sense?
From the bottom of my heart I do not mean any offense, but I think you are mistaking this as a structural issue whereas in you are just "doing it wrong" as the lolcat would have said. But, I have been wrong a million thousand billion times before and this could sure as hell be one of those times again.
Post by Dayo is ignored
Re: GLOBALS.php "Bug"??
Wed, 27 April 2011 08:55
Ernesto
Karma:
I see, and referencing the variables as globals within the function as I suggested does not work?
Post by Dayo is ignored
Re: GLOBALS.php "Bug"??
Sun, 24 April 2011 11:50
Ernesto
Karma:
You need to define it as global in your function since it is included.
IE
<?php
include(
'globals.php'
);
function Function() {
global
$global
,
$global2
,
$etc
;
echo
$global
;
}
?>
Post by Dayo is ignored
Current Time:
Wed May 14 01:22:44 EDT 2025
Total time taken to generate the page: 0.03533 seconds