ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Is it possible to access different controller from one

May 15, 2008 6:06pm

Subscribe [1]
  • #1 / May 15, 2008 6:06pm

    mobile software

    1 posts

    Is it possible to access different controller from other
    like:
    $this->load->controller(‘controllers/header’,$data,TRUE);
    the same as we can run
    $this->load->view(‘partials/header’,$data,TRUE);

    I need to access my forum controller from other controllers and not to pass every time the same arguments to the view.
    Is it possible?

    Thanks.

  • #2 / May 15, 2008 7:22pm

    gtech

    824 posts

    Hello,

    Have a hunt on the forums for this as it has been discussed many times before.

    http://ellislab.com/forums/viewthread/47132/
    http://ellislab.com/forums/viewthread/55212/
    http://ellislab.com/forums/viewthread/46168/

    there are three ways I can think of:
    >The easiest way is to create a library or helper for commonly used functionality.
    >You can also extend /inherit an existing controller
    >Or move the common functionality to the model.

    all are discussed in the threads above.

  • #3 / May 15, 2008 8:07pm

    mobile software

    1 posts

    Thanks a lot, I’ve created BaseController class with hidden functions starting with _ .

  • #4 / May 15, 2008 8:24pm

    gtech

    824 posts

    no probs.. welcome to CI.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases