Simple OOP question - using include()d files in a class
Posted: Mon May 14, 2012 3:25 pm
Hi,
I hope this isn't too dumb a question, but here goes...
In my application I have a library class that contains all the common functions used by every section of my site, and when I try to access (say) the login page, a "login" class is called that extends the library class - the top of each script looks like this:
The problem I have now is that the BasicFunctions class is becoming very big and unwieldy, so what I'd like to do is to split some of its functions into different files - one for authentication, one for form validation, etc.
What I can't work out is how to include() these within the class without losing the local reference, so if "authentication.php" contains a function called CheckUserAgent() that was originally defined in the BasicFunctions class I need it to be accessible from $this->CheckUserAgent().
Can anyone offer any suggestions please?
Thanks in advance,
Mecha Godzilla
I hope this isn't too dumb a question, but here goes...
In my application I have a library class that contains all the common functions used by every section of my site, and when I try to access (say) the login page, a "login" class is called that extends the library class - the top of each script looks like this:
Code: Select all
class Login extends BasicFunctions {
// do login specific stuff here
}
class MyAccount extends BasicFunctions {
// do my account specific stuff here
}What I can't work out is how to include() these within the class without losing the local reference, so if "authentication.php" contains a function called CheckUserAgent() that was originally defined in the BasicFunctions class I need it to be accessible from $this->CheckUserAgent().
Can anyone offer any suggestions please?
Thanks in advance,
Mecha Godzilla