I have an SMF forum installed, which is a non-OO application. I'm hoping to create an additional application in a directory within the forum, that includes the SSI file from SMF and then uses the functions from within SMF, but in an Object Oriented setting.
If this isn't possible then stop reading here and please explain why, because I'm struggling to work out what's wrong here (might be the fact that I've been awake for almost 24 hours)
So this is what I have:
SMF Has a file, SSI.php - When included, this sets a load of global variables, and also sets a definition of
define('SMF', 'SSI');
I have a folder called console, which has a series of files. From index.php, I call my Servlet file, which has
require_once '../SSI.php';
class Servlet
{
public function __construct(){
}
public function processRequest(){
echo SMF;
var_dump($context) //This is the global variable that should be set
}
}
This outputs SSI and then an undefined variable error.
This is probably really obvious, but why is the definition being set and not the context global? If I do this outside of a class, it works.
Thanks!
-Edit-
Just to explain why this isn't a duplicate of the linked question ... I don't really think it needs much explanation other than this is a specific question regarding a specific scope problem and a specific error, tailored to my application which is a mixture of OO and procedural programming, which lead to some confusion.
My question was not "What is a variable scope?"
Thanks.