I have a controller in / application / core
/application/core/CMS_Controller.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require APPPATH."third_party/MX/Controller.php"; class CMS_Controller extends MX_Controller { public function __construct() { parent::__construct(); } public function show_something() { echo "something shown"; } }
I have one more controller in the module (/modules/my_module/controllers/controller.php) which is extended with CMS_Controller
/modules/my_module/controllers/controller.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Controller extends CMS_Controller { public function index() { $this->load->view('view'); } }
And, in view.php (/modules/my_module/views/view.php), I do this: /modules/my_module/views/view.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $ci =& get_instance(); echo $ci->show_something(); ?>
And I get this error:
Fatal error: calling the undefined CI :: show_something () method in / home / gofrendi / public _html / No-CMS / modules / my_module / views / view.php on line 3
It will work if I do not use MX_Controller and use CI_Controller instead: /application/core/CMS_Controller.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); //require APPPATH."third_party/MX/Controller.php"; class CMS_Controller extends CI_Controller { public function __construct() { parent::__construct(); } public function show_something() { echo "something shown"; } }
Does anyone know what's wrong here?
goFrendiAsgard
source share