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: How to call and where to place bloqs variables in templates?

Status Resolved
Add-on / Version Bloqs 3.2.0
Severity
EE Version 3.5.16

Ludvik Herrera

Oct 02, 2018

Description: I have a few content bloqs to structure a page based on type of content.

Heading
Text
Quote
Image

We’ve figured how to put the content on each of these bloqs on the page. But we’re wondering if we have 6 blocks of the same type, say 6 text blocks. Can we just render the first two, or the third text block only?

Field Group Type: Bloqs
Name: Body
Short Name: body
Block Types:
-Heading
-Text
-Image
-Quote

Bloqs Configuration
Name: Text
Short Name: text
Atoms:
Type:
1. Wygwam
Name: content
Short Name: content
2. Radio Buttons
Name: Position
Short Name: position

Template code

{body}
        
        {if text}
        {text}
        <div class="row">
            <div class="col">
            {content}
            </div>
        </div>
        {/text}
        {/if}
       {/body}

But I want to render the first text box only, however the following code does not work:

{body}
        
        {if text:count=="1"}
        {text}
        <div class="row">
            <div class="col">
            {content}
            </div>
        </div>
        {/text}
        {/if}
       {/body}


Detailed steps to reproduce the issue:
1.
2.
3.

 

#1

BoldMinded (Brian)

Hi, Ludvik. Take a look at the docs https://eebloqs.com/documentation/templates I think what you’re looking for is {blocks:count:of:type}. {block_name:count} is not a valid variable name.

#2

Ludvik Herrera

Hi Brian,

I’ve read the documentation templates page, I’m not certain on how to use the code for the variables. Or it isn’t working.

I’ve tried what I sent you earlier, are you saying it will work like this:

{body}
        {if "{text:count:of:type}"=1}
        {text}
        <div class="row">
            <div class="col">
            {content}
            </div>
        </div>
        {/text}
        {/if}
       {/body}

or is it

{body}
        {if "{blocks:count:of:text}"=1}
        {text}
        <div class="row">
            <div class="col">
            {content}
            </div>
        </div>
        {/text}
        {/if}
       {/body}

Or is it entirely a different placement and call?

#3

BoldMinded (Brian)

{blocks:count:of:type}, exactly as it appears in the docs.

Login to reply