Welcome Guest, Not a member yet? Register   Sign In
Controller inside a view

Hi, I'm developing some app and I'm trying to use a template-like method, for example, in the left side I'll load all users in my app and I want to do it in a view but that view needs a controller to load everyone, my question is: How can I load a controller in a view? if this is possible, if not how can I do this. Thanks in advance :-)

HMVC allows me to load controllers in my views. For example, in my views/header.php file...
echo modules::run('pages/navigation/widget', 'header');
Good luck

You have it backwards. Use a controller to get your data, then send it to your view(s).

[eluser]Zeeshan Rasool[/eluser]
In CI, you can not call controller directly in view. You need to perform all your actions inside controller and then pass your result to view.
In your current scenario, you need a parser method. See parser help for this. You can parse your left panel and just pass this parsed array to final view.

Theme © iAndrew 2016 - Forum software by © MyBB