What kind of HTML file code is {% ... %}

What sort of code is this inside an HTML file and where can I learn more about it?  (My guess it is somehow related to Python.  Even so, I'm looking to for educational documentation.  I'm guessing not ASP since I think that is <% and %>)

{% if show_new_page(request) %}
  {% extends "base_new.html" %}
{% else %}
  {% extends "base_old.html" %}
{% endif %}

Open in new window

LVL 13
Hugh McCurdyAsked:
Who is Participating?
This seems to be Django templating, as you mentioned Python.

It could also be twig, http://twig.sensiolabs.org/ which is the same (or at least very similiar) templating language for PHP

Probably you look at a web site driven by Django.

This means your HTMLtemplate is being processed by a Django view before being sent to a browser.

Some doc about Django templating:
Dave BaldwinFixer of ProblemsCommented:
The only thing I've found that is even close is jQuery templating but that doubles up the curly braces at the beginning and the end like "{{% else %}}".
Ishaan RawatDesigner | Developer | ProgrammerCommented:
according to me this is somekind of conditional ....
I'm sure its not ...








It can't be python ...
Its something else...
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Gerwin Jansen, EE MVETopic Advisor Commented:
It's twig, have a look here for example:

Ishaan RawatDesigner | Developer | ProgrammerCommented:
yaa its a knd of PHP coding
Hugh McCurdyAuthor Commented:
Django rings a bell.  Since I'd never used it, I just "noted it" when I was reading the docs.  Django is probably correct.  I'll investigate and assign points if that appears to be correct.

Thank you.
Hugh McCurdyAuthor Commented:
Thanks everyone.  Turns out that it is Django template code.
Gerwin Jansen, EE MVETopic Advisor Commented:
How can we know it's django? From the sample you gave it could very well be twig :)
Just looking at the template code, there is no easy way to find out whether it is Django or twig.
(Except one finds one template statement implemented in one and not in the other)

The mentioning of Python suggested Dlango as twig is used by PHP.

Without further information, about the server in question there is probably no way to distinguish them.

The only way to be sure is to look on the disks for either php files or python files referring to above mentioned template files. (In the 'worst' case though very improbable, they could even be used by PHP code AND by Python code)

I assume, that hmccurdy invistigated further on his server (or on the documentation about the server) to find out.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.