[eluser]Keat Liang[/eluser]
here is my codes, i made a simple example,
Code:
/application/modules/welcome/controllers/welcome.php
/application/modules/welcome/views/welcome_view.php
tested with follow link with no problem
Code:
index.php/welcome
index.php/welcome/put
index.php/welcome/get
here is the code
Code:
<?php
class Welcome extends Controller {
function __construct()
{
parent::Controller();
$this->load->library('session');
}
function index()
{
$this->load->view('welcome/welcome_view');
}
function put()
{
$this->session->set_userdata(array('some_key' => 'some_val'));
}
function get()
{
echo $this->session->userdata('some_key');
}
}
problem start here from another module
Code:
/application/modules/hello/controllers/hello.php
/application/modules/hello/views/world_view.php
here is the controller code
Code:
class hello extends Controller
{
function __construct()
{
parent::Controller();
}
function index()
{
$this->load->view('hello/world_view');
}
function nolib()
{
//this work
echo Modules::run('welcome/welcome/index') . '<br/ >';
}
function withlib()
{
//not working
echo Modules::run('welcome/welcome/put') . '<br/ >';
}
function withlib2()
{
//not working either
echo Modules::run('welcome/welcome/get') . '<br/ >';
}
function withlib3()
{
//not working either
$this->load->module('welcome/welcome');
echo $this->welcome_welcome->method() . '<br />';
}
}
when i try to extend MX_Controller
Code:
class hello extends MX_Controller
{
function __construct()
{
parent::MX_Controller();
}
function index()
.........
and i get this.....
Code:
Call to undefined method MX_Controller::MX_Controller()
one more question if i wanna use this Extension, can i still using Base controller similar to MY_Controller ?
MY_Controller.php
i try modify to this
Code:
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
/* The MX_Controller class is autoloaded as required */
class MY_Controller extends MX_Controller{
function __construct()
{
parent::MX_Controller();
}
}
then the controller extends from MY_Controller not working too... i try everything i know still nothing come out. any help will be appreciated.
sorry for my bad english.