Get config item in model |
Like in subject, I need to get some values from config. Normally I using
PHP Code: $this->config->item( 'MyOption' ); but in model (normal file and MY_Model) I getting Code: Parse error: syntax error, unexpected '$this' (T_VARIABLE) ... Where is my bad?
PHP Code: class Notification_model extends ENC_Model {
Hi,
$this object can not be use out of a method. PHP Code: class Notification_model extends ENC_Model {
A few thoughts:
1. Make sure that ENC_Model extends CI_Model, so that it will reference the global controller instance when you try to access something you don't have. 2. Or change that line to get_instance()->config->item('TableSections'); 3. Or pass that config setting into the model from the controller or library that calls it. |
Welcome Guest, Not a member yet? Register Sign In |