문제

I am using WireDesignz modular extensions with great success so far. I now have the need to extend a controller within the module. I have created the new controller and the original, now extended, controller and they work fine outside of the HMVC but when I put them inside the module folder and call the new controller it days is can't find the controller it's extending... even though it's right there in the same directory. If I call the original one it's all fine. I'm not sure where to go with this as I can't find anyone with the same problem online. Any ideas? Here's a bit more:

Original controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Calendar extends MY_Controller {...

New controller, in same directory:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Calendar_new extends Calendar {...

Results in:

Fatal error: Class 'Calendar' not found in /home/d/e/demo/web/public_html/application/modules/calendar/controllers/calendar_new.php on line 2

Thanks.

도움이 되었습니까?

해결책

The base controller class which you are extending is not being included as a resource. Codeigniter will not automatically try to load base classes.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include('Calendar.php');
class Calendar_new extends Calendar {...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top