|
|
|
|
|
by smt88
4098 days ago
|
|
Sorry, should have clarified "code-less". I definitely don't like logic in templates (although React is making me re-think that as a strict policy). But I actually meant code as in any code. A line in PHP might be this: <a href="<?php echo $some_url ?>">Some link</a>
So that "echo" is the code. And the same thing in Jinja is this: <a href="{{ some_url }}">Some link</a>
In Jinja, it's only HTML + the names of variables (which I guess you could call "data"). I can now take that line and use it with any language that supports Jinja-style syntax (PHP, Node, Python, etc.) It's also not unlikely that a designer will know it.Also, sometimes when you use PHP, you have to sacrifice correctness or speed for readability. You don't have that problem when you're running templates that were compiled to PHP, rather than hand-written PHP. Finally, template inheritance is absolutely amazing. Can't live without it now. |
|