Re: MVC: code in views

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

 



On Mon, 2016-01-04 at 16:15 -0500, Paul M Foster wrote:
> 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.
> > 
> > Thanks,
> > Ash
> > 
> > http://www.ashleysheridan.co.uk
> > 
> 
> 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
> idea of what's going on. I personally hate Javascript, but I can
> 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
> 

I don't think Tedd was making it sound so simplistic, and I didn't
intend to either. I work with some very talented frontend developers,
who not only know HTML, but CSS and Javascript to a level I'm jealous
of. They're working every day with frameworks like Angular and React,
and tools like Gulp, Node, and Grunt, and creating their own things from
all of that. They have the kind of knowledge in frontend that I have
with PHP.

There's always a slight tradeoff with generalising or specialising in
skills. I'm not saying that either way is bad or good, but sometimes
there may be room for possible accommodation? This may be in the form of
making changes that means others don't need to, or helping others make
changes so that you don't need to.

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