[eluser]Rick Jolly[/eluser]
[quote author="Edemilson Lima" date="1200614138"]...but what I really want (I guess) was a way to load controllers within views or load constructors instead. We could have something like:
Code:
$this->load->constructor('[folder/]file','function'[,$data][,true/false]);
Such method could load the file and execute the function, passing the optional $data array and print or return the output to the caller constructor or view. Loaded constructors could also load another views or constructors.
Well, I don't know the impact of this or even if it is possible, but I think it could solve this issue.[/quote]
CI can only run one controller per request, but you can accomplish something similar in the view. You can call a helper function in the view that loads a specified library and calls the correct method of that library. The library would return a view with it's data as a string and the helper would echo that. Search for HMVC in these forums.
Also, I don't think anyone has mentioned extending the CI controller. You could put all your common code in the constructor of a parent controller that extends the CI controller. Then instead of extending the CI controller, you'd extend your custom parent controller. There are lots of examples in these forums.