• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller inside a view

#1
[eluser]Unknown[/eluser]
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 :-)

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

#3
[eluser]mattpointblank[/eluser]
You have it backwards. Use a controller to get your data, then send it to your view(s).

#4
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.