Controller / model separation, templating |
[eluser]dejan[/eluser]
[quote author="batfastad" date="1348359839"]Ok this is great stuff so far. 7) Is it valid to return FALSE from a method in a model and test that in the controller? For example... [/quote] Sure it is, why wouldn't it be? Quote: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 prefer to do all formatting in the view. Quote: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. No, don't do it like that. If you do, you'll end up with a mess like Wordpress Take a look at this: PHP: Alternative syntax That syntax is devised for control structures (loops, ifs, etc.) when outputting HTML. So, e.g. in your view, you would do something like: Code: <h1>Products</h1> That looks very clean, in my opinion, and is easy to read and maintain. |
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
|