Welcome Guest, Not a member yet? Register   Sign In
Accessing constants defined in models
#1

[eluser]srisa[/eluser]
Hello,

If I define a constant in a model as const REL = 1;, how do I access that constant from outside the model?

I just ran a test, I can access it as className::const. Assuming my model is define as
class Options extends Model{
const REL = 1;
}

In the controller I am referring to that constant like this
$this->load->model('options');
echo 'constant is '.Options::REL.'<br />';

Is that acceptable or is there a better way of doing this?

Thank you.


Messages In This Thread
Accessing constants defined in models - by El Forum - 11-25-2008, 09:13 AM
Accessing constants defined in models - by El Forum - 11-26-2008, 03:44 PM
Accessing constants defined in models - by El Forum - 11-26-2008, 05:42 PM
Accessing constants defined in models - by El Forum - 11-27-2008, 06:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB