6 ms·
You have just mixed HTML and server code. You fail.
by banana_bread 14y ago
You have just mixed HTML and server code. You fail.
- Kilimanjaro 14y agoThat'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?
- drivebyacct2 14y agoFunny 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.
- Kilimanjaro 14y agoExactly, 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.