MVC: code in views

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Thanks,
Ash

http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux