Welcome Guest, Not a member yet? Register   Sign In
How calling function
#1

[eluser]iniweb[/eluser]
Example:

News.php
Code:
<?php

class News extends Controller {

    function News()
    {
        parent::Controller();    
    }
    
    function Index()
    {
        $content = '';

        $content .= $this->uri->segment('1');

        $data = array(
                       'content'  => $content,
                 );

        $this->parser->parse('Empty.tpl', $data);
    }
}

?>

Code:
<?php

class Main extends Controller {

    function Main()
    {
        parent::Controller();    
    }

    function Func()
    {
        $content = "";

        $data = array(
                       'content'    => $this->News_block(),
                       'cat_block'  => $this->Cat_block(),
                                 );

        $this->load->library('parser');
        $this->parser->parse('Main.tpl', $data);
    }
}

?>

How on News class call Func() function !?
#2

[eluser]unosoft[/eluser]
You cannot call a function in one controller from another controller. Instead, you need to move the Func() function to a Library and load the library in both the controllers.

hth
Kumar Bhogaraju




Theme © iAndrew 2016 - Forum software by © MyBB