• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller / model separation, templating

#6
[eluser]batfastad[/eluser]
Ok this is great stuff so far.

Final questions for now...
7) Is it valid to return FALSE from a method in a model and test that in the controller?
For example...
Code:
// CONTROLLER
if (!$data = $this->model->query($input)) {
    show_error('Model returned false');
} else {
    // LOAD VIEW
}

8) Where do I post-process data from my model, e.g. date formatting, number formatting any other if() blocks to build up full HTML strings etc.
I'm guessing this should happen in the view since it's output/display related. Is that correct?

9) I'm really not keen on using inline PHP. Especially when looping through data and building multiple tables and complex pages as it makes the design of the view more difficult to update.
Is it acceptable to do all my looping, processing etc at the top of the view in PHP, then echo a heredoc block containing the HTML code with PHP vars?

Cheers, B


Messages In This Thread
Controller / model separation, templating - by El Forum - 09-21-2012, 11:00 AM
Controller / model separation, templating - by El Forum - 09-21-2012, 11:03 AM
Controller / model separation, templating - by El Forum - 09-21-2012, 03:47 PM
Controller / model separation, templating - by El Forum - 09-21-2012, 11:53 PM
Controller / model separation, templating - by El Forum - 09-22-2012, 12:41 AM
Controller / model separation, templating - by El Forum - 09-22-2012, 05:23 PM
Controller / model separation, templating - by El Forum - 09-23-2012, 11:31 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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