Welcome Guest, Not a member yet? Register   Sign In
error explanation
#1

[eluser]boytun[/eluser]
Hello friends.

I'm using in my application HMVC architecture, and I get this errors wich I can understand .
I try to load my module in the mvc view.
this the code of the module controller(widg_html.php):
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Widg_html extends MY_Controller {

public function __construct()
{
  parent::__construct();
  $this->load->model('mdl_widg_html');
}


public function show()
{
  $query=$this->mdl_widg_html->get('id');
  foreach ($query->result() as $row) {
   echo "<h3>".$row->body."</h3>";
  }
}


}
and this is the code of the module model(mdl_widg_html.php):

Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mdl_widg_html extends CI_Model {

public function __construct()
{
  parent::__construct();
    
}

public function get($orderby)
  {
   $this->db->order_by($orderby);
   $query=$this->db->get('widg_html');
   return $query;
  }

}


and this is how I call the module in the view:
Code:
&lt;?php
echo Modules::run('widg_html/show') ;
?&gt;

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Widg_html::$mdl_widg_html

Filename: controllers/widg_html.php

Line Number: 19


Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\application\modules\widg_html\controllers\widg_html.php on line 19

Please can some Help me?
Thanks in advance


Messages In This Thread
error explanation - by El Forum - 04-13-2013, 12:39 PM
error explanation - by El Forum - 04-13-2013, 03:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB