All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

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: Is there a {bloq_var_foo} limit?

Status Resolved
Add-on / Version Bloqs 4.8.0
Severity
EE Version 6.0.6

Nick Bedard

Aug 31, 2021

I’m curious if I’m able to utilize {bloq_var_foo} AND {bloq_var_bar} from one parent in one child Bloq; I don’t see why not… Here is my setup (both variables are basic Text fields: bloq_var_headline and bloq_var_sub below):

{homepage_bloqs}
          {featured_project_bloq}
          <div data-block-name="featured_project_bloq">
                  <h2>{project}
                    {project:title}
                  {/project}
                  </h2>
<p>                  </p><h3>{alternative_project_title}</h3>
<p>                  <img src="{featured_project_image:url:webp}" alt=""/><br />
                  {bloqs:children}<br />
          </p>
</div>
<p>          {/featured_project_bloq}</p>

<p>          {homepage_banner_slideshow_bloq}<br />
          </p><div data-block-name="homepage_banner_slideshow_bloq">
<p>          </p><h1>{bloq_var_headline}</h1>
<p>          </p><h2>{bloq_var_sub}</h2><p> <!-- This outputs the field contents just fine --><br />
            </p><div class="homepage-slideshow">
<p>              {bloqs:children}<br />
            </p>
</div>
<p>          </p>
</div>
<p>          {/homepage_banner_slideshow_bloq}</p>

<p>          {homepage_featured_projects_bloq}<br />
          </p><div data-block-name="homepage_featured_projects_bloq">
<p>            </p><div>{id}</div>
<p>            {bloqs:children}<br />
          </p>
</div>
<p>          {/homepage_featured_projects_bloq}</p>

<p>          {homepage_banner_slideshow_slide_bloq}<br />
          </p><div data-block-name="homepage_banner_slideshow_slide_bloq">
<p>            </p><div class="slide-content position-absolute h-100 w-100">
<p>              {if '{bloq_var_headline}'}</p><h1>{bloq_var_headline}</h1><p>{/if} <!-- Outputs just fine --><br />
              {if '{bloq_var_sub}'}</p><h2>{bloq_var_sub}</h2><p>{/if} <!-- This is where the error stems from --><br />
 <!-- If I remove the conditional and just try to output the variable value, I receive no data (blank) h2 tag--><br />
            </p>
</div>
<p>            {image}<br />
            </p><picture>
              <source type="image/webp" media="(max-width: 576px)" srcset="{image:webp width='576' quality='90'}">
              <source type="image/jpeg" media="(max-width: 576px)" srcset="{image:lowres}">
              <source type="image/webp" media="(max-width: 768px)" srcset="{image:webp width='768' quality='90'}">
              <source type="image/jpeg" media="(max-width: 768px)" srcset="{image:lowres}">
              <source type="image/webp" media="(max-width: 992px)" srcset="{image:webp width='992' quality='90'}">
              <source type="image/jpeg" media="(max-width: 992px)" srcset="{image:medium}">
              <source type="image/webp" media="(max-width: 1200px)" srcset="{image:webp width='1200' quality='90'}">
              <source type="image/jpeg" media="(max-width: 1200px)" srcset="{image:medium}">
              <source type="image/webp" media="(max-width: 1440px)" srcset="{image:webp width='1440' quality='90'}">
              <source type="image/jpeg" media="(max-width: 1440px)" srcset="{image:medium}">
              <source type="image/webp" media="(min-width: 1441px)" srcset="{image:webp width='1920' quality='90'}">
              <source type="image/jpeg" media="(min-width: 1441px)" srcset="{image:medium}">
              <img class="banner-background" style="object-fit:cover;" loading="lazy" src="{image:medium}" alt="{if image:description}{image:description}{if:elseif description}{description}{if:else}Homepage slideshow image {bloqs:count}{/if}"/>
            </picture>
<p>            {/image}</p>

<p>            {bloqs:children}<br />
          </p>
</div>
<p>          {/homepage_banner_slideshow_slide_bloq}</p>

<p>      {/homepage_bloqs}

This code renders {bloq_var_headline} just fine when the following line is commented out; even when not in a conditional, I am not getting any data for {blog_var_sub}. The conditional for {if '{bloq_var_sub}’} causes “Unexpected ‘Test heading’ (<—that is the content of the h1 tag) (VARIABLE); expected RD in Template “pages/index” on line 64.” If I swap the conditionals for ‘bloq_var_sub’ and ‘bloq_var_headline’, I receive the same error message.

 

#1

BoldMinded (Brian)

I just discovered a few days ago that the {bloq_var_*} variables are not parsing correctly when using the new {bloqs:children} tag. I’ve been looking into a fix but haven’t found it yet. You’re probably running into the same bug :(

#2

Full Circle Developers

At least I’m not going crazy. Fingers crossed for a speedy (and easy) patch.

#3

BoldMinded (Brian)

Comment has been marked private.

#4

Full Circle Developers

Comment has been marked private.

#5

BoldMinded (Brian)

Try removing the conditionals for a minute and confirm that the values are at least where you expect them. If this is a conditional related issue I’d like to confirm that so I know what to debug.

#6

Full Circle Developers

I tried doing so, and the values only appear in their initial ‘parent’ block, not in the child bloq.

#7

BoldMinded (Brian)

Do you have bloqs caching turned on or anything? I have a test page I’ve been working on where the bloq_var_ variables are definitely cascading down to the children, and I sent you the same build. Are you 100% sure all the files are getting updated correctly? This new build even introduces a new way to set variables. In a parent bloq you can do this:

{bloqs:set name="headline" value="This is a headline!"}

Then where you currently have {bloq_var_headline}, it’ll override the value. I just tested this exact variable name and even used some of your template code to make sure there were no parsing errors. Here is some of your template code where I’m setting the headline value in a parent bloq. The same should be working for fields with the prefix bloq_var_

https://www.dropbox.com/s/laxmvi9jiapykkh/ticket-2315.png?dl=0

#8

Full Circle Developers

I tried explicitly setting in my config file:

$config['bloqs_cache_enabled'] = false;

I emptied all caches thru the EE utilities, cleared my browser caches (and tried multiple browsers).. Nonetheless, utilizing that new way to set variables allows the content to parse correctly in my template.

I’m a little confused myself. I have deleted and rebuilt those Bloqs with the exact same names in this EE setup, though, so I thought that maybe there’s a database issue there. So, I tried creating a completely new parent Bloq and child Bloq with the same arrangement, and am still seeing the same problem

{homepage_bloqs}

        {slideshow_test}
        <div data-block-name="slideshow_test">
                {test}
                <h1>{bloq_var_test}</h1> <!-- Seeing the text fine -->
                {bloqs:children}
        </div>
        {/slideshow_test}

        {slideshow_slide_test}
        <div data-block-name="slideshow_slide_test">
                <h2>{bloq_var_test}</h2> <!-- Empty tag output -->
                {bloqs:children}
        </div>
        {/slideshow_slide_test}

{/homepage_bloqs}

Again, the new syntax works, so I can utilize that.

To be clear, my {slideshow_test} Bloq has one child atom named “bloq_var_test”. That’s all I’d need to do within the Bloqs config to get that embedding/var passing to work, correct?

#9

BoldMinded (Brian)

I found a bug in the new code I sent, sorry about that. I’ve been making a lot of changes and I accidentally broke this. Yes it should work, I’ll send a new build as soon as I can.

#10

BoldMinded (Brian)

Comment has been marked private.

#11

Full Circle Developers

Fabulous, works just fine now with both the ‘old’ syntax and the new. I really appreciate the quick turnaround on this. Thanks so much, Brian!

#12

Full Circle Developers

Hi Brian,

Running into an issue with this recent version you supplied me; I cannot reorder Bloqs correctly when editing my entries. I can drag and drop, and in the Control Panel the ordering of Bloqs is saving, yet the output places the newest created Bloq within the page at the top of my template output. Not sure if there’s something that I need to update in this version or a setting on my end? I couldn’t see any issues upon first glance on my end. Otherwise, the other issue from this original ticket has been working just fine.Thanks.

#13

BoldMinded (Brian)

In the TagController.php file, around line 451, is a sort($parsedSections); call. Comment that line out and see what happens.

#14

Full Circle Developers

Fixed the issue. Thanks again, Brian.

Login to reply