I believe the number one reason I have for changing my mind is Django.
Using a template language (that isn't native language code) has a lot of benefits. First of all, it allows you to create your own, very strict set of functionality that is allowed in templates. This will automatically cause greater separation of presentation logic. It shouldn't be so easy to do the wrong thing. Second, it allows you to create the clearest, most concise syntax for the most complex and unclear things. For instance, template inheritance. I tried to implement a template inheritance system in plain php and it was sooo ugly and clunky looking. Look how sexy django's is.The Django Template Docs Page wrote:If you have a background in programming, or if you’re used to languages like PHP which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express presentation, not program logic.
The Django template system provides tags which function similarly to some programming constructs – an if tag for boolean tests, a for tag for looping, etc. – but these are not simply executed as the corresponding Python code, and the template system will not execute arbitrary Python expressions. Only the tags, filters and syntax listed below are supported by default (although you can add your own extensions to the template language as needed).
base.html (layout file)
Code: Select all
<html>
<head>
<title>{% block title %}This is the default title{% endblock %}</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>Code: Select all
{% extends "base.html" %}
{% block content %}
<h1>Contact Us</h1>
<p>To contact us, you'll need to find out where we are. Good luck!</p>
{% endblock %}