im passing a variable into html from python through flask, is there a way to display a certain image if the value is less or more than a number?
Question:
What I guess im asking is there a way to do logic in html? If not what would be the best way to do what I want to do?
is there a way to do something like
if {{ fkdr }} < 1:
<img src="image.png" width="250" height="250">
Answers:
If you are using Flask’s render_template then yes you can use Jinja’s if statement:
{% if fkdr < 1 %}
<img src="image.png" width="250" height="250">
{% else %}
Do something when there is no fkdr... or delete this else block leaving the endif below
{% endif %}
What I guess im asking is there a way to do logic in html? If not what would be the best way to do what I want to do?
is there a way to do something like
if {{ fkdr }} < 1:
<img src="image.png" width="250" height="250">
If you are using Flask’s render_template then yes you can use Jinja’s if statement:
{% if fkdr < 1 %}
<img src="image.png" width="250" height="250">
{% else %}
Do something when there is no fkdr... or delete this else block leaving the endif below
{% endif %}