• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is'this correct? (Load content from a view)

[quote author="deviant" date="1186513670"]It really all depends on the logic of your Controllers. If you are just pulling data out from a Model and dumping it into a view then there is nothing wrong with a single Controller, but if you are performing lots of different operations on the data you get from the Model before putting it into a view then yes you will need multiple Controllers.[/quote]

ok thank you Big Grin

And in this case, i think that teory of extend controller is a good idea as you say before

[eluser]CI TaMeR[/eluser]
No you use one controller for 1 sometimes up to 3 views

For example one controller can control company info
the list of all companies in your database
the single view of one company
and a form to post and edit the content

This would take 3 view files one controller.

I share portions of the view file with all pages by having a
header.php, footer.php and style.css file so that the website looks the same all over.

I use this if I need to just view something and don't need any html, which is 90% of my pages.

echo $body;



I call it like this from the controller:
$this->tpl['body'] = $this->table->generate($Calc);
$this->load->view('blank', $this->tpl);

Otherwise my view pages look like this:

html goes here



If you need something more complex.
There is an add in library someone made to control view files. I found this one but there is a better one which I couldn't find. Searching is up to you.

Thank you again!
Big Grin really useful!!

[eluser]CI TaMeR[/eluser]
No problem any time.

Yes Tamer, but I think he was getting the impression we were trying to say put his entire application in a single Controller, as in someone putting User Profiles, Blogs and Forums all in the same Controller, which wasn't what was meant.

[eluser]CI TaMeR[/eluser]
Well that was the problem we didn't know what he was asking. Why would anybody extend the controller for view files anyway?
I think he is still trying to understand the concept.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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