Welcome Guest, Not a member yet? Register   Sign In
Problem with loading Model
#1

[eluser]chotz[/eluser]
I am getting the following error when i try to load the model.
"Unable to locate the model you have specified:".
I read all the related threads to this problem.
I have checked the class name and the file name. There is no case sensitive
issue here.

I can't figure out whats causing this error.
Please help me!

Here is my Model:

<?php

class Test extends Model{

function index(){
echo 'loaded the model';
}

}
?>

and i have named this file as test.php. and i have saved this under model/GameDev/test.php

Here is how i load the model from Controller


<?php

class Newsadmin extends Controller{

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

function ldmodel(){
echo 'Loading model ... ';
$this->load->model('/GameDev/test.php');
}

function show(){

$this->load->view('/GameDev/newsad_view.php');

}


}

?>
#2

[eluser]chotz[/eluser]
Wow i found the solution myself immediately after posting this problem.

i was using $this->load->model('/GameDev/test.php'); to load the model.
i should not have used .php extension. I removed .php and it works fine now.

But $this->load->view('/GameDev/newsad_view.php'); this works fine even if i give
.php extension.

strange...

-Arun
#3

[eluser]Dam1an[/eluser]
I think it might be because views can be of differant file types, by default it looks for .php, but it could be .html, .htm, .tpl etc
A model can only be a PHP file, so you don't get the option to specify it, as theres's no need, at least thats my assumption




Theme © iAndrew 2016 - Forum software by © MyBB