Welcome Guest, Not a member yet? Register   Sign In
Mysql Results Conditional
#7

[eluser]johnpeace[/eluser]
Quote:his approach of getting the view to do ALL formatting and presenting of the data is a bit more than most people do, and it also means that there is generally more PHP code in the view than some people like.

It's not that it's more PHP than people like...

It's that there's more PHP, that's identical to other PHP, scattered across multiple view files.

It looks like this strict, dogmatic adherence to your idea of what MVC architecture is would have us writing a procedural if/else to display the icon throughout the site all over the place. That same code would need to appear wherever the icon appears.

What if the icon changes filenames or other attributes?
What if I decide to do it with '+' and 'x' characters instead?

If I run the code in a helper function that is called in the view files, I only have one function to maintain/change.

I don't know that I even agree with the premise that putting this code in a helper ISN'T putting it in the view. If a view uses a helper...does the helper not become part of the view? What about all of the CI native helpers (date, language, etc)...they can be used in views, right?

Like most things, there's not a great necessary need for absolute, black/white dogmatic rules about how to do things. Architectures and design patterns are great starting points...but really shouldn't be leveraged AGAINST your own ingenuity and creativity. As long as you aren't 'coding stupid' and are building an app that you can maintain...<shrug> go for it.


Messages In This Thread
Mysql Results Conditional - by El Forum - 12-22-2010, 10:31 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 11:11 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 11:19 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 09:26 PM
Mysql Results Conditional - by El Forum - 12-22-2010, 09:51 PM
Mysql Results Conditional - by El Forum - 12-23-2010, 08:26 AM
Mysql Results Conditional - by El Forum - 12-26-2010, 07:52 AM
Mysql Results Conditional - by El Forum - 12-26-2010, 07:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB