# How to program a if-instruction in the template node by using html

**URL:** https://discourse.nodered.org/t/how-to-program-a-if-instruction-in-the-template-node-by-using-html/953
**Category:** General
**Created:** [20 June 2018 11:47 UTC](https://discourse.nodered.org/t/how-to-program-a-if-instruction-in-the-template-node-by-using-html/953 "2018-06-20T11:47:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [20 June 2018 11:47 UTC](https://discourse.nodered.org/t/how-to-program-a-if-instruction-in-the-template-node-by-using-html/953/1 "2018-06-20T11:47:53Z")

</div>

Hello,

I got a problem with my template node. in this node I load a Picture in the Dashboard.  
Now I want the picture to change when the payload changes too. Unfortunately I have no idea how to do this.

---

<div class="post-metadata">

### Author: ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)
#### Post date: [20 June 2018 14:54 UTC](https://discourse.nodered.org/t/how-to-program-a-if-instruction-in-the-template-node-by-using-html/953/2 "2018-06-20T14:54:03Z")

</div>

If you want to render an html element based on some `msg.payload` data, you can use a `ui_template` node. For instance, assuming you can have a relative url string in your payload, you can insert it into an `<img>` src attribute using this syntax:

```auto
<img style="width: 300px; height: 200px;" src="{{msg.payload}}">

```

Every time a new payload arrives, the image src is updated, and the new image appears on the dashboard (or a broken image icon, if the url is not valid).

---

<div class="post-metadata">

### Author: ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)
#### Post date: [21 June 2018 06:07 UTC](https://discourse.nodered.org/t/how-to-program-a-if-instruction-in-the-template-node-by-using-html/953/3 "2018-06-21T06:07:50Z")

</div>

thank you, now I fix it!
