Re: [PHP] MVC: code in views
- Date: Mon, 4 Jan 2016 16:15:55 -0500
- From: Paul M Foster <paulf@xxxxxxxxxxxxxxxxx>
- Subject: Re: [PHP] MVC: code in views
On Sun, Jan 03, 2016 at 09:43:47PM +0000, Ashley Sheridan wrote:
> Hi all,
> Just wanted to get some thoughts from others on the list. Recently I've
> been trying to avoid using any PHP code at all in my views at all, not
> even an if statement or for loop. The general idea is that I want to
> make it as easy as possible for developers who do no PHP at all (I work
> with a lot of them) to be able to work more easily.
> So far I've been doing this by moving the little logic bits that might
> otherwise end up in the views to controllers or the template engine to
> handle, and use a basic templating system that the frontend developers
> can use.
> What are peoples' thoughts on this? Am I going down the wrong path with
> wanting to keep my views HTML-only, or is this something that any of you
> are trying to do? I'm finding the benefits only when working with others
> in a team, otherwise I've no problem with PHP in views myself.
> As an aside, it has made things slightly easier when it comes to using
> CodeSniffer to analyse code quality, because a lot of the tests were
> throwing false positives because of the mix of HTML and PHP in the view
> files. Keeping things separate now means that an error in a view is a
> true error.
I'll have to agree with Tedd on this. You can't simply roll through web
work knowing only HTML. My wife has designed a slew of websites, but
I've had to school her in HTML and CSS because she designs with the
WYSIWYG of Dreamweaver. And if you specialize in HTML, you don't have to
know all there is about PHP to be able to read some of it and get an
actually write it to some extent and I can more or less read and
understand it as long as some idiot doesn't try to obfuscate it.
Long story short: Tell your devs (politely) to grow up and quit whining.
Paul M. Foster
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php