1
Well, my doubt is how I load a controller/method into another controller, in Codeigniter 2.2.2
<?php if(! defined('BASEPATH')) exit('No direct script access allowed');
class Inicio extends CI_Controller {
public function index(){
$this->load->library('controllers/Desenvolvedor/Desenvolvedor');
}
}
//Esse é o controlador principal.
Like this, I have 1 main controller, and through it I want to "ask" another controller that is inside a folder, in this case , Controllers/Developer/Developer.php (developer the first is the folder and the second is the name of the controller that equals the folder);
– Luís Carlos Von Muller Júnior
I recommend that you can edit your question, and add this supplementary comment information to the body of the question, making the question better and clearer. And if possible even provide more details than you want to do, making it clearer to anyone who can help you.
– Fernando Leal
From the code, I think it’s pretty bad to do it like this, because opening a
Library
inside the briefcaseController
, does not carrycontroller
within anothercontroller
, who knows telling what you want to solve, ie, what is your problem?– novic
The name of it is POG. It may work, but it’s bad practice (I think). When you get to the point of having to carry one controller inside the other it’s time to think more about using a library, or a helper. That is, if the controller will house a function that must be accessed by others controllers, then what you need is a library, or a helper. In the MVC, the function of controller is to respond to interim requests model and view, and not serve data.
– ShutUpMagda