[eluser]bigtony[/eluser]
[quote author="obiron2" date="1248198184"]Sorry bigtony, I don't agree[/quote]
And you're perfectly entitled to!
[quote author="obiron2" date="1248198184"]You can do that where a NULL dataset could be legitimate, but the view is not the place to trap errors.[/quote]
Agreed, but I don't consider empty result sets to be an error. It's still 'data', just zero data.
[quote author="obiron2" date="1248198184"]Your front end programmers should not need to put conditional statements into their views, every piece of data that comes through $data should be defined by the controller.
[/quote]
The problem with doing it in the controller is that then the controller is effectively telling the view how things should be viewed, and it should be the job of the view to decide how things are viewed.
Here are some examples:
1. You have a table of sales figures and want to display all values in excess of $1,000 in bold red, but other values in normal font. This would be a conditional in the view, and would make no sense in the controller.
2. You have separate views for different devices, e.g. normal screen or mobile device. On the full screen you can say "No records found on the database" whereas on the mobile device you might just want it to say "Empty" to save space. But if you try to set it up in the controller then the controller has to know what each output device is going to do. Far cleaner to just pass the data in and let the views format it as they see fit.
3. On zero results, you might want to show an image and paragraphs of html formatted instructions. Again, let the view do the work. That's what views are for.
The job of the controller is, in an ideal world, ONLY to be the interface between the model(s) and the view(s). It invokes model functions to get or update data (without having to know how the model does it) and invokes views to present that data (without having to know how the view does it).
If you still disagree, please come back - this is just my interpretation of MVC. But I believe it best delineates the purposes of the three elements.