Picture changes depending value MySQL twig -


i using datatabales in twig file.

in table there delete, edit , show button. delete , edit buttons working code wrote.

now trying show button working. show green dot(picture) if value in mysql table 1. show red dot if value in mysql table 0. fieldname in table show.

i trying:

<a href="show/"><{%if {{record.data.show=[0]}}img src="link : img      src="otherlink" %} class="edit" align="right"></a> 

but doesn't work. clue?

you got syntax mixed up.
either use shorthand expression

<img src="{{ var ? 'source.jpg' : 'other_source.jpg'}}" /> 

or use full {% if %} {% endif %}

<img src="{% if var %}source.jpg{% else %}other_source.jpg{% endif %}" /> 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -