Re:PHP Addiction
by banana_bread on Friday June 29, 2012 @02:11PM
(#4178109)
You have just mixed HTML and server code. You fail.
Re:PHP Addiction
by Kilimanjaro on Friday June 29, 2012 @02:16PM
(#4178147)
That's php, just cleaner. If we don't recognize that as one of php's strength we're doomed to fail.
Of course once you master it, you separate the code from the html and call it from the view like this:
hello.nxt
name = request.get('name','world')
list = ['this','language','rocks']
response.render('hello.html',name,list)
hello.html <h1>Hello {{ name.upper }}</h1>
<ul>
{% for item in list %}
<li>{{ item }}</li>
{% endfor %}
</ul>
But what do I know about language design or human behavior?
Re:PHP Addiction
by drivebyacct2 on Friday June 29, 2012 @03:04PM
(#4178440)
Funny mixing PHP into HTML is one of the things I hate the very most. And is one of the first problems usually solved by PHP web frameworks. Well, templating is actually generally a primary component of "all pieces included" web frameworks in any language.
Re:PHP Addiction
by Kilimanjaro on Friday June 29, 2012 @04:09PM
(#4178785)
Exactly, but that's the easiest way to start learning. That's how everybody got their feet wet in web development. Then you jump to MVC and best practices.
My point is, the language has to be designed as a web framework from the get go, routers, templates, models, everything should be right there so noobs feel confident from day one. That's the only way to conquer the world.
Create a mod_next and try it on any web server like apache, nginx, etc. It should work without any extra fiddling with config files or installing frameworks or template engines.
It should just work!
That's the kind of platform that would leave php behind once and for all.