![]() |
Redeclaring class, but i don't ?
Well i keep getting this error:
Fatal error: Cannot redeclare class clean in /customers/pulse101.net/pulse101.net/httpd.www/dev1/backend/classes/clean.class.php on line 66 But i just can't understand it :( Here is the file with the "error"? PHP Code:
PHP Code:
|
My guess is that you're including the file that contains the
clean class twice. |
But i don't the only place it gets included is in the __constructer :/
This is really annoying ^_^ ^^ |
I don't know about other people, but I once accidentally tried instantiating an extension of a class from within the class that it was extending, and it would kill apache everytime. I don't think you're supposed to be allowed to do that. (To break it down, it looks like even though clean extends p101, you're calling clean from within p101)
-m |
I'm pretty new to the whole OOP thing, so could you break it down so that a 3 year old would understand it?? :-$
|
Well my first question would be, do you really need to extend p101? It looks to me like they're two completely different beasts, ie, p101() intializes your classes and adds objects to a library, whereas clean() is meant for sanitizing strings/variables. When you extend a class in Object Oriented Programming it's generally so that the child class can use some method or property of the parent/super class in conjunction with new methods that it defines. If the two classes don't use any similar properties or methods, and in this case, don't even really do the same thing, there shouldn't be a need to create the child->parent relationship of an extended class.
Um, and I don't want to insult your intelligence because I'm sure you can keep up, but broken down for a three year old, I guess I would say something along the lines of.... well, spyke, that's a question you should be asking your mom. -m |
Well, the plan is to start creating somekind of Framework thingy, where i wan't to use the class p101 as an umbrella, from where i can call every other class, and then i wan't it to be like, you class p101, class A and class B. Then i wan't it to be able to use functions from A in B it the plan is that everthing gets "called" through class p101..
It is still very much work in progress as i'm very fresh in the entire OOP world :) I hope you understand my little plan ^_^ |
Kind of a chained singleton. You still don't need to extend anything at this point though, since you'll be able to call clean a la
PHP Code:
If you want a great book on PHP object orientation and design patterns, take a peek at: APRESS.COM : PHP Objects, Patterns, and Practice, Second Edition : 9781590599099 That book and Pro PHP are snazzy. -m |
Well, i looked at you links and decided to do it my own way, to ensure readabilty to me, and so that i know it works :)
|
| All times are GMT. The time now is 02:39 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0