Welcome Guest, Not a member yet? Register   Sign In
call controller from another one
#1

[eluser]EugeneS[/eluser]
i know this topic was here several times but we still dont have any solution.
i lso know this way is against mvc specification Smile


so i need to receive all controller methods from another controller.

lets imagine i have controller and i need to create an object from another controller to use get_class_methods function ... smth like this (just to show you an idea):

Code:
class ScanModules extends Controller {

    var $scanpath;

    function ScanModules()
    {
        parent::Controller();    

        $this->load->library('common');
        $this->common->Visitor();
        $this->scanpath = './system/application/controllers/';

        ........
        ........
        ........

        $file_name = 'award.php';
        $this->_readClass($file_name);
    }


    function _readClass($file_name, $directory = NULL)
    {
        if (preg_match("/([a-zA-Z\-0-9]*?)\.php/i", $file_name, $class_name))
        {
            $class_name = $class_name[1];
            include($this->scanpath.$directory.$file_name);
            $tmp_class = new $class_name;
        }
    
    }

........
}

so when i call $tmp_class = new $class_name; i receive error:
(sure award.php is usual CI controller which load libraries, helpers etc and which is also extends "controller" .... so how to be ?)

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: About::$mItemCategory

Filename: libraries/Loader.php

Line Number: 921

Fatal error: Call to a member function _assign_libraries() on a non-object in C:\.....\system\libraries\Loader.php on line 921


so how to be ?


Messages In This Thread
call controller from another one - by El Forum - 11-30-2007, 06:08 AM
call controller from another one - by El Forum - 11-30-2007, 06:18 AM
call controller from another one - by El Forum - 11-30-2007, 07:50 AM
call controller from another one - by El Forum - 11-30-2007, 09:04 AM
call controller from another one - by El Forum - 11-30-2007, 01:13 PM
call controller from another one - by El Forum - 12-01-2007, 02:10 AM
call controller from another one - by El Forum - 12-01-2007, 03:11 AM
call controller from another one - by El Forum - 12-01-2007, 05:12 AM
call controller from another one - by El Forum - 12-01-2007, 05:36 AM
call controller from another one - by El Forum - 12-01-2007, 05:42 AM
call controller from another one - by El Forum - 12-01-2007, 05:51 AM
call controller from another one - by El Forum - 12-01-2007, 06:01 AM
call controller from another one - by El Forum - 12-01-2007, 06:19 AM
call controller from another one - by El Forum - 12-01-2007, 06:32 AM
call controller from another one - by El Forum - 12-01-2007, 07:29 AM
call controller from another one - by El Forum - 12-01-2007, 08:20 AM
call controller from another one - by El Forum - 12-01-2007, 10:51 AM
call controller from another one - by El Forum - 12-01-2007, 11:19 AM
call controller from another one - by El Forum - 12-03-2007, 07:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB