1

I have what should be a very straightforward grid field with very straightforward template code, but the contents are not being displayed in the template. AFAICT I'm using the grid field the same way that I've used it elsewhere on the same site without problems (basically, the grid is used to set up images with alt text, caption, etc). So I'm wondering if there's a problem at a database level -- but I have no idea how to diagnose or fix that.

The grid field's name is about_company_photo ad the columns are named image, alt, and caption. The grid has a single row (the field is set to minimum rows: 0, maximum rows: 1), and the image file itself is showing up in the File Manager. Looking at the entry in the CP it looks fine. This is all using native EE stuff, v 2.7.3. My template code is:

{if about_company_photo}
    <img src="{about_company_photo:image}" alt="{about_company_photo:alt}" title="{about_company_photo:caption}">
{/if}

The template is outputting the ing element, so presumably it is recognising that there is content in the grid itself, but the img tag's src, alt and title attributes are being left empty. Does anybody have any idea why this might be?

  • I should add that the alt and caption columns of the grid field are populated. The template just seems not to be displaying their contents. – RickL Mar 28 '14 at 10:52
1

Stupid me, I see it now. Forgot to include the Grid field's own loop around the column identifier tags. Note to self: don't code tired. D’oh!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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