logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

Programmatic rendering of a node image

29/07/2025, by Ivan
Forums

Good day.

There is a separate template for a group of nodes. Each node contains several images. It is necessary to programmatically output the images using a single template.

Example:

<li><img src="../_shared/img/img6.jpg" width="600" height="400" alt=""></li>

<li><img src="../_shared/img/img5.jpg" width="600" height="400" alt=""></li>

So if I do it like this, I will need to create a separate template for each node, which is not very convenient.

I tried to output it like this:

<img src="<?php print render($node->$field_image['und'][0]['uri']);?>"  width="600" height="400" alt="">.

But it doesn't work this way.

It turns out that it needs to automatically read and output the URL of each node image.