Class selector method question |
[eluser]Th3FalleN[/eluser]
What I am attempting to do is use selectors similar to this Code: Class::method() instead of Code: $this->class->method() for libraries but I keep receiving errors. I'm sure its something silly but I figured i'd ask the experts.
[eluser]theprodigy[/eluser]
one is a variable instance, the other is a class reference. $this->class = 'class' is a variable that CI creates when instantiating the class. Class = the class name, not necessarily the variable representing an instance of the class
[eluser]Th3FalleN[/eluser]
I saw it done in another ci project but could not figure out why it works over there. Say im using an asset library i'd like to be able to do is insted of Code: $this->assets->css('cssfile'); Code: Assets::css('cssfile');
[eluser]theprodigy[/eluser]
You should be able to do that if you just include() or require() the file yourself, then the class would be in php's memory. Either that or setup an autoload function to handle auto loading it into memory.
[eluser]danmontgomery[/eluser]
One is static, one is not. I'm confused why you're trying to do this without understanding the difference between the two, though http://php.net/manual/en/language.oop5.static.php |
Welcome Guest, Not a member yet? Register Sign In |