Extract content objects from relations object in an EZ Publish template


/ Published in: eZ Publish
Save to your folder(s)

The sidebar_box is an object of type relations object.


Copy this code and paste it in your HTML
  1. {let attribute=$node.data_map.sidebar_boxes}
  2.  
  3. {section show=$attribute.content.relation_list}
  4. {section var=Relations loop=$attribute.content.relation_list sequence=array( bglight, bgdark )}
  5. {section show=$Relations.item.in_trash|not()}
  6. {let object=fetch( content, object, hash( object_id, $Relations.item.contentobject_id ) )}<br />
  7.  
  8. {section show=$object.main_node_id|null|not}
  9.  
  10. {$object.current.data_map.header.data_text}
  11. {$object.current.data_map.content.data_text}
  12.  
  13. <div class="image">{attribute_view_gui attribute=$object.current.data_map.media_library_object.content.contentobject_attributes.2}</div>
  14.  
  15. {/let}
  16.  
  17.  
  18. {/section}
  19. {/section}
  20. {section-else}
  21. {'There are no related objects.'|i18n( 'design/standard/content/datatype' )}
  22. {/section}
  23.  
  24. {/let}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.