I have a parent channel of "events" with a relationship field named {cf_event-map} with a singular relationship to an entry in a channel named "maps". This is the simplified code I'm using, the summary field is displaying fine but the {cf_images} field is an Assets fieldtype, and I can't find a permutation that retrieves the sub-field data from that field.

{exp:channel:entries channel="events" limit="1"}
{cf_event-map:cf_images}{cf_images:url}{/cf_event-map:cf_images} (this doesn't work)

I think you need to wrap the sub-tags with the tag pair.

{exp:channel:entries channel="events" limit="1"}

Also, inside an Assets loop, you just need to use {url}. You don't need to prefix it unless you specify it using var_prefix="my_prefix".

  • Adding the {cf_event-map} tag pair makes no difference, and the {cf_event-map:cf_summary} works without it. Also tried just {url}.
    – Paul Frost
    Jun 26 '13 at 7:50
  • Wouldn’t the “cf_event-map:” prefix on the {cf_summary}, {cf_images}, and {/cf_images} tags also not be necessary, when using the full {cf_event-map}...{/cf_event-map} tag pair? Jun 26 '13 at 11:06
  • If I delete the prefix it just displays the {cf_summary} data from the parent entry. I'm using the same channel field group for both channels. There is only a single related entry.
    – Paul Frost
    Jun 26 '13 at 22:09

Assets 2.1.4 will contain the fix for this and should be available next week (3rd July ish). Andris (P&T) sent me some code to change and test and it's working fine. If you need the fix urgently ask me and I can pass on the instructions.

Part of the issue was also how to test if no results in the child, and the code for that is below in case anyone else finds it useful.

{if "{relationship_field:assets_field:total_files}"}
<p>Do this</p>
<p>Do something else</p>
  • I'm in a bind, and would be grateful if you could share that code!
    – Jon Horton
    Jul 2 '13 at 15:38
  • John, send me an email (in my profile) and I'll forward the instructions.
    – Paul Frost
    Jul 2 '13 at 21:51

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.