Need help to my controller :( |
[eluser]tunabelly14[/eluser]
Sorry for this simple question. It just happen that I'am new using the codeigniter. This is my question, Im getting a 404 error because of my controller although I already put the name of the controller into the line. Im using codeigniter 1.7.2 for this. Thank you in advance guys.. http://localhost/globedez/index.php/globedez/main here are the codes that I used. //Controller file: globedez_controller.php <?php class Globedez extends Controller { function Globedez() { parent::Controller(); } function main() { $this->load->library('MyMenu'); $data['menu']=$menu->show_menu(); $data['webtitle']='Globedez|Portfolio'; $data['webfooter']='copyright step by step'; $this->load->view('globedez_home',$data); } } ?> //this is my code at my library: globedez_library.php <?php class MyMenu { function show_menu(); { $obj=& get_instance(); $obj->load->helper->('url'); $menu="<ul>"; $menu.="<li>"; $menu.= anchor("globedez/main","Home"); $menu.="</li>"; $menu.="</ul>"; return $menu; } } ?> //this is the code of my view. globedez_home.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $webtitle;?></title> </head> <body> <?php echo $menu;?> </body> </html>
[eluser]jalalski[/eluser]
make the name of the file 'controllers/globedez.php' and it should get picked up. HTH
[eluser]tunabelly14[/eluser]
I already change the filename but it doesn't allow controllers/globedez.php so I just save it as globedez.php It shows now different error indicating: "An Error Was Encountered Unable to load the requested class: mymenu" I dont know how does it happen because "MyMenu" is the name of the class inside of the library. I hope we can solve this problem. Can you please also explain to me why the globedez.php works while the previous name of controller doesn't work. Thank you again.
[eluser]jalalski[/eluser]
Naming of files is very important. Take a look at: http://ellislab.com/codeigniter/user-gui...llers.html Similar concerns apply to Libraries and to Models. HTH
|
Welcome Guest, Not a member yet? Register Sign In |