0

I have a grid field named 'cf_results', which has a column named 'file' which is an assets data type. The other columns are text types named 'link-text' and 'link-url'. There will either be a file or a link-url but not both. I'm getting a set of 3 PHP error notices for every entry on the page, regardless of there being data in the assets field of an entry or not see attached screenshot. But it all seems to be working otherwise.

enter image description here

This is the template code:

{if cf_results}
    <ul>                        
    {cf_results}
    <li>
        <a href="{cf_results:file}{cf_results:link-url}">{cf_results:link-text}</a>
    </li>
    {/cf_results}
    </ul>
{if:else}
    <p>Results will be available soon.</p>
{/if}
2
  • Have you tried re-saving the field settings for that Grid field? – Derek Hogue Nov 5 '15 at 20:02
  • I tried that an no difference, so I started stripping down the template, see below for my sort of answer. – Paul Frost Nov 6 '15 at 10:20
0

This is not really an answer, but editing the original question would have been really messy.

It seems that the error is nothing to do with the cf_results Grid field. I kept removing bits of code from the page until I didn't get the PHP error, and it was the cf_image field (which is an Assets fieldtype but is not in a grid) that was causing it. The key bit of code that needed to change was this:

<img src="{made}" alt="{cf_images:caption}{if cf_images:author}, Source:{cf_images:author}{/if}" />

to this

<img src="{made}" alt="{cf_images:caption}, Source:{cf_images:author}" />

The if condition was causing it, but exactly the same code is used on another template and works perfectly and without any error. It makes no sense to me.

1
  • I now believe this to be a bug in 2.10.1, as I'm having other problems with IF conditionals not working correctly. – Paul Frost Nov 19 '15 at 14:06

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.