My CI controller looks like this:
// Controller.
class Hello extends CI_Controller
{
public function one($name)
{
$this->load->model("hello_model");
$profile = $this->hello_model->getProfile("Me");
//$profile2 = $this->hello_model->otherAction();
$this->load->view('header');
$data = array("name" => $name);
$data['profile'] = $profile;
$this->load->view('one.html', $data);
}
}
and here is/are the model(s)
class Hello_model extends CI_Model
{
public function getProfile($name)
{
return array("fullName" => "Martin", "Age" => 28);
}
}
class Hello_model_2 extends CI_Model
{
public function otherAction()
{
echo "Data";
}
}
When I enable the $profile2 statement and visit the controller in the browser, I find this error message in Apache Error log:
[Mon Apr 01 ...] [error] [client 127.0.0.1]
PHP Fatal error:
Call to undefined method Hello_model::otherAction() in
/.../CodeIgniter_2.1.3/application/controllers/Hello.php on line x
where x is the line of the profile2 statement.
Can I not have two classes in a "model"-file?
Btw, what are .php files called in CI-speak? Modules?