![]() |
How to use MY_controller with ci 2.0 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to use MY_controller with ci 2.0 (/showthread.php?tid=38365) |
How to use MY_controller with ci 2.0 - El Forum - 02-06-2011 [eluser]chefnelone[/eluser] I used to use MY_controller in this way in ci 1.7 but isn't working in ci 2.0 No error message, just a blank page... In a fresh ci installation: application/controller/welcome.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); library/MY_controller.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); What am I missing? Thanks How to use MY_controller with ci 2.0 - El Forum - 02-06-2011 [eluser]mejlo[/eluser] Hi, move application/libraries/MY_Controller.php to application/core/MY_Controller.php When you extend core class, you must put it in "core" directory How to use MY_controller with ci 2.0 - El Forum - 02-06-2011 [eluser]chefnelone[/eluser] [quote author="mejlo" date="1297040342"]Hi, move application/libraries/MY_Controller.php to application/core/MY_Controller.php When you extend core class, you must put it in "core" directory[/quote] I've done what you said, but I get this error message: A PHP Error was encountered Severity: Notice Message: Undefined property: Welcome::$load Filename: controllers/welcome.php Line Number: 12 Line 12 is: $this->load->view('welcome_message'); How to use MY_controller with ci 2.0 - El Forum - 02-06-2011 [eluser]cideveloper[/eluser] According to the code you showed, you are missing a line in your MY_Controller Code: class MY_Controller extends CI_Controller{ How to use MY_controller with ci 2.0 - El Forum - 02-07-2011 [eluser]chefnelone[/eluser] [quote author="cideveloper" date="1297075151"]According to the code you showed, you are missing a line in your MY_Controller Code: class MY_Controller extends CI_Controller{ Thanks, I modified the code for this post, then I forgot to change. How to use MY_controller with ci 2.0 - El Forum - 02-16-2011 [eluser]Stefano G[/eluser] As a suggestion, maybe it could be a good idea to put the information of "moving the MY_Controller and MY_Model -and everything that extends the core classes- into the application/core directory" in the UPGRADING section of the new user guide ![]() |