Constant in a class |
[eluser]sl3dg3hamm3r[/eluser]
Hey there I wonder how I could access a constant in a class/library from outside through CI's loading mechanics: Code: [...] Now, in a controller, this doesn't work: Code: $this->load->library('lib_test')); Any suggestion how to access constants (or class-vars)? Sl3dg3
[eluser]roj[/eluser]
From my reading of it you'd want to use: Code: echo lib_test::CONSTANT The first method you've attempted is fine in php 5.3 apparently. The second will read the object variables. You can read more on object constants in the [url-http://uk.php.net/manual/en/language.oop5.constants.php]php manual[/url] You should also note that libraries should be capitalised...User guide
[eluser]sl3dg3hamm3r[/eluser]
stupid, I didn't think of leaving away '$this' :rolleye: ... about the rest you wrote I'm perfectly well informed, I was just fast-typing. Thx mate.
|
Welcome Guest, Not a member yet? Register Sign In |