1

I've got a grid field called 'images', it has 2 columns in it, a 'files' field, which I've called 'file' and a 'text input' field, which I've called 'caption'. I've got an entry with several images in the 'files' field, and some text in the 'caption' field, but I can't work out how to display these on the front-end, this is what I've got, which doesn't work:

{images}
    <img src="{file_url}" alt="{caption}" title="{caption}" />
{/images}

I've also tried {file} and {url} in the src but nothing seems to work. If I use the {exp:file:entries} tag that just outputs all my images, and doesn't output the caption anyway.

Any help would be very much appreciated.

1 Answer 1

3

Your syntax is not following the user guide's instructions. http://ellislab.com/expressionengine/user-guide/modules/channel/grid.html#template-tags

You need to add the prefix for each column.

{images}
    <img src="{images:file_url}" alt="{images:caption}" title="{images:caption}" />
{/images}
1
  • Thanks, sorry didn't see that. All working now :) Commented Nov 26, 2013 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.