Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Reach child’s information in parent.

Status Resolved
Add-on / Version Bloqs 4.2.3
Severity
EE Version 5.3.1

Pontus Madsen

Apr 20, 2020

Hi,

Silly question, but I haven’t been able to find an answer.

When doing nested items, the children just gets placed right before the {close:parent}.
Is there a way to place child somewhere where I want it to be? Specially if there’s two kids, and they should be placed in middle and start, not end of parent.

Ex:

In this example, “child 1” will get output at the end, which is as it should be, but how could I get “child 2” to get output’ed where I want?

{bloq_puff_content}
    {startpage_puff_image_left}

    <div data-block-name="startpage_puff_image_left">
        {startpage__image_left_header}
        {!-- PLACE INFO FROM CHILD 2 HERE--}
        {startpage_image_left_ingress}
        {startpage_image_left_image}
        {!-- PLACE INFO FROM CHILD 1 HERE--}
    {close:startpage_puff_image_left}
      </div>
    {/close:startpage_puff_image_left}

    {/startpage_puff_image_left}
{/bloq_puff_content}
#1

BoldMinded (Brian)

Hi, Pontus! Can you provide more information? I’m not familiar with your site so what you provided is hard to follow. What exactly are “startpage__image_left_header”, “startpage_image_left_ingress”, and the “startpage_image_left_image” fields? What do they contain? Which one is what I assume to be the Relationship field. You said “children”, but did not clarify what exactly that means.

#2

Pontus Madsen

So, maybe it’s easier if I describe it like this:

Let’s say I create 3 Bloqs. - Bloq_1 = Has a header and text - Bloq_icon = Has a path to an icon - Bloq_USP = Has a text field with an UniqueSellingPoint

Bloq_icon and Bloq_USP can only be children of Bloq_1.

The code for this would look like this

{bloq_content}

 {bloq_1}
    <div data-block-name="bloq_1">
        {header}
        {text}
    {close:bloq_1}
      </div>
    {/close:bloq_1}
    {/bloq_1}
{/bloq_1}

{Bloq_icon}
    <div data-block-name="Bloq_icon">
        {icon_path}
    {close: Bloq_icon}
      </div>
    {/close: Bloq_icon}
    {/Bloq_icon}
{/Bloq_icon}

{Bloq_USP}
    <div data-block-name="Bloq_USP">
        {usp}
    {close: Bloq_USP}
      </div>
    {/close: Bloq_USP}
    {/Bloq_USP}
{/Bloq_USP}

{bloq_content}

So far so good.

When I show this on the page it would (as it should shown like this:

<div data-block-name="bloq_1">
        {header}
        {text}
          <div data-block-name="Bloq_icon">
              {icon_path}
          </div>
          <div data-block-name="Bloq_USP">
            {usp}
          </div>
      </div>

My question is … is it possible to in some way “code” where I want the children (Bloq_icon and Bloq_USP) to be show.. so that the output could be more like this (or however I chose to use the children of Bloq_1):

<div data-block-name="bloq_1">
          <div data-block-name="Bloq_icon">
              {icon_path}
          </div>
        {text}
          <div data-block-name="Bloq_USP">
            {usp}
          </div>
        {header}
      </div>
#3

BoldMinded (Brian)

Unfortunately no, there isn’t a way to do that I know of to do that with how you currently have the blocks defined. In order to get that sort of layout, it sounds to me that you need to add the fields/atoms from Bloq_icon and Bloq_USP into the same block as bloq_1, then you can control the output the way you want.

Bloqs functions very similarly to Grid, and there isn’t a way to tell the 3rd row to render in between the 1st and 2nd row unless you add the same Grid field pair to the page multiple times.

You might be better off refactoring your blocks and atoms/fields a little differently if you can.

#4

Pontus Madsen

Will do, thanks for the swift reply! 😊

Login to reply