Publisher is EE6 compatible, but it does not support the Fluid field. 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: Looping over children twice with a different template within a parent bloq (or passing in a bloq_var into children)

Status With Customer
Add-on / Version Bloqs 4.12.5
Severity
EE Version 6.3.4

Rick Harrison

Aug 01, 2022

We’re building a site at the moment where we’re wanting to show some tabbed content, so i’ve got one bloq acting as “container”, then a separate looping child bloq for each individual tabs content.
Ideally, we’d like to loop over the child items twice within the parent bloq with a different template for each, so the first loop i can output the tab headings, the 2nd loop the actual tab content - I’d guess the nicest (simpler?) way is probably having the ability to pass in a bloq_var to the children (which, on trying, doesn’t seem to be possible currently?)

<section class="tabbed-content">
   <ul class="tabs">
       {bloqs:children bloq_var_tyoe="tabs"}
  <ul>
  <ul class="slides">
      {bloqs:children bloq_var_type="slides"}
  </ul>
</section>


(and then within the child bloq content have an {if} statement on the bloq_var_type to output different html on each call)

(i did try to be clever and do the following below as a bit of a hack, but sadly it doesn’t work as it appears EE uses the returned content from the 2nd call to bloqs:children to replace both instances of the call)

{bloqs:set name="tab_loop_type" value="tab"}
    <ul class="tabbed_slider__tabs">
            {bloqs:children}
    </ul>
<p>    {bloqs:set name="tab_loop_type" value="content"}<br />
    </p><ul class="tabbed_slider__content">
            {bloqs:children}
    </ul>

 

 

#1

BoldMinded (Brian)

Aug 02, 2022

Hi, Rick. The first thing you should do is download Bloqs 5 and see if the issue persists. I made a few rendering and parsing updates in that version.

Login to reply