php - TWIG syntax do not show field IF -


i have script written in twig.

weight: {{ doc.weight }} kgs<br /> 

// part of script shows text information "detail" , "info" mysql fields if these fields not empty

                {% if "" == doc.info_hl %}                     {% if '' != doc.detail_code %}                         <b>info: {{ doc.info }}</b>                     {% endif %}                 {% else %}                     info: {{ doc.info_hl|raw }}                 {% endif %}                 <br />                  {% if "" == doc.detail_code_hl %}                     {% if '' != doc.detail_code %}                         <b>details: {{ doc.detail_code }}</b>                     {% endif %}                 {% else %}                     <b>details: {{ doc.detail_code_hl|raw }}</b>                 {% endif %} 

sometimes mysql field "weight" have values "0.00"

how modify code above - not show "weight" mysql field if value in field "0.00" ? can see above how can empty text fields, how decimal fields equals "0.00" ?

thanks in advance hint try !

what write

{% if '0.00' != doc.weight %} weight: {{ doc.weight }} kgs {% endif %} 

or better

{% if not ('0.00' == doc.weight) %}... {% endif %} 

?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -