[eluser]Unknown[/eluser]
I set value to a language related variable (actually a property) in
post_controller_constructor this way:
Code:
$ci =& get_instance();
...
$ci->lngcode = some_value;
I can retrieve this variable in views:
$this->lngcode, but it is not possible in models, as $this->lngcode throws an error here. Unfortunately, i need this value in a model.
I am relatively new to CI so my first question is: why $this->lngcode is wrong here in the model?
Is it OK (a good practice?) to retrieve this variable by referencing the CI superobject in the model (i tested and it works):
Code:
$ci =& get_instance();
...
echo $ci->lngcode // do something with the value
or should i pass this value in the controller as a parameter to the model's method?
Thx for help!