Usually, phpBB ignores undefined template variables. For instance, in a condition block where USER_ID has to match an ID and USER_ID variable is not defined, the entire condition block is ignored. Using twig, you can check if the variable is available or not before by using {% if customVar is defined %} :I'm still interested in the general question though, because it could be handy for something else. Is there a non-insane way of checking for a custom variable?
Code:
{% if CAR is defined %}{% if CAR == 'Toyota' %}This is a Toyota car.{% endif %}{% else %}Variable CARS is not defined.{% endif %}
Hope this answers your question.
Statistics: Posted by Anișor — Wed Apr 16, 2025 2:39 pm