I am currently trying to integrate Drupal and CodeIgniter PHP framework. Basically it works quite well but I have some problem calling drupal's template API...

this is the code I have in my drupal module

    function cheeseburger_ci() {
        // process the query string
        _cheeseburger_ci_request_process($_GET['q']);
        require_once dirname(__FILE__) . '/index.php';
    }

    function theme_cb($content) {
        echo theme('page', $content);
    }

and the code to call the theme function

        public function test() {
            // set up a form
            return theme('cb', $this->load->view('test', '', TRUE));
        }

Then I am greeted with these error messages although I have the content displayed in the content area without problem.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: no_module_preprocess

Filename: includes/common.inc

Line Number: 1498

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: no_theme_preprocess

Filename: includes/common.inc

Line Number: 1498

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: script_links

Filename: javascript_aggregator/javascript_aggregator.module

Line Number: 91

Comments

chx’s picture

As Drupal 5 is shipped it sets error_reporting(E_ALL ^ E_NOTICE) so these are not reported. You should do the same. Use Drupal 6, that's notice free.
--
The news is Now Public | Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile. |

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

Jeffrey04’s picture

thanks for the information

Jeffrey04’s picture

I hope I am not being over reacting but I don't feel really good when getting all those notices... To get rid of the notices, I dug the forum for a better solution and i came out with this... Then I load the page (error_reporting(E_ALL)) and get all those mentioned notices again.

    /**
     *  Start the codeigniter application
     */
    function ignited_drupal_start_app() {
        ob_start();
        _ignited_drupal_process_request($_GET['q']);
        require dirname(__FILE__) . '/index.php';
        $output = ob_get_contents();
        ob_end_clean();
        error_reporting(E_ALL);
        return $output;
    }

Then I tried with the following code

    /**
     *  Start the codeigniter application
     */
    function ignited_drupal_start_app() {
        $output = 'some output';
        print_r(get_defined_vars());
        error_reporting(E_ALL);
        return $output;
    }

without declaring any variables, and get_defined_vars() returns an empty array. but strange enough that php doesnt even return a single notice even I have not done something to fix "Message: Undefined variable: no_theme_preprocess" ...?