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: count(): Parameter must be an array or an object that implements Countable

Status Resolved
Add-on / Version Simple Grids & Tables 1.2
Severity
EE Version EE 4.3.2

Grant Jackson

Jul 08, 2018

Hi there,

Description: I have a very simple table that is spitting out an error.
• count(): Parameter must be an array or an object that implements Countable.
• user/addons/simple_grids/ft.simple_table.php, line 135

This is a duplicate site from another one however the error is showing up here for the first time.

Detailed steps to reproduce the issue:
1. Input any table content
2. Output any table to the front end
3. See the errors at the top of the page

#1

BoldMinded (Brian)

I’m unable to replicate this. Can you please share a screenshot of your field settings?

#2

BoldMinded (Brian)

Please also share the template code you’re using to render the field.

#3

Grant Jackson

Hi there, Thanks for the quick response.

Here is a link to the channel content: https://www.dropbox.com/s/2x3y3gf5elaxc7m/screencapture-hcbebenefits-admin-php-2018-07-09-22_48_48.png?dl=0 Here is a link to the channel field: https://www.dropbox.com/s/474houievlun5dc/screencapture-hcbebenefits-admin-php-2018-07-09-22_48_14.png?dl=0

[code} {insurance_sections:insurance_section_data_table}

<style type="text/css">
    .table>tbody>tr>td &#123;
        padding: 8px 12px;
    &#125;
</style>

<!-- Start Pricing Table 1-1 -->
<section class="content-block">
    <div class="container">
        <div class="row">  
            <div class="col-md-12">
                <table class="footable table table-stripped" data-sorting="false"  center; font-size: 14px;">

                &#123;content prefix="content:st:"&#125;
                    <tr data-id="{content:st:row_id}" class="{switch='footable-odd|footable-even'}">
                        &#123;content:st:columns&#125;
                            &#123;if content:st:is_first_row&#125;
                                <th data-id="{content:st:column_id}"  center; font-weight: normal; background-color: #00A3E1; color: #fff;">
                                    <strong>&#123;content:st:value&#125;</strong>
                                </th>
                            &#123;if:elseif content:st:row_id == "2"&#125;
                                <td data-id="{content:st:column_id}"  center;">
                                    &#123;content:st:value&#125;
                                </td>
                            &#123;if:elseif content:st:is_last_row&#125;
                                <td data-id="{content:st:column_id}">
                                    <i>&#123;content:st:value&#125;</i>
                                </td>
                            &#123;if:else&#125;
                                <td data-id="{content:st:column_id}">
                                    &#123;content:st:value&#125;
                                </td>
                            &#123;/if&#125;
                        &#123;/content:st:columns&#125;
                    </tr>
                &#123;/content&#125;

                </table>
            </div>
        </div><!-- /.row -->
    </div><!-- /.container -->
</section>
<!-- End Pricing Table 1-1 -->

{/insurance_sections:insurance_section_data_table} </code></pre>

#4

BoldMinded (Brian)

I think your markup is incorrect. If insurance_sections is your Grid field, then it should be the following. You’ve added an extra {content} tag pair that I don’t know what its supposed to be.

{insurance_sections}

  <style type="text/css">
      .table>tbody>tr>td {
        padding: 8px 12px;
      }
  </style>

  <!—Start Pricing Table 1-1—>
  <section class="content-block">
      <div class="container">
        <div class="row"> 
          <div class="col-md-12">
              <table class="footable table table-stripped" data-sorting="false"  center; font-size: 14px;">

              {insurance_section_data_table prefix="content:st:"}
                <tr data-id="{content:st:row_id}" class="{switch='footable-odd|footable-even'}">
                  {content:st:columns}
                      {if content:st:is_first_row}
                        <th data-id="{content:st:column_id}"  center; font-weight: normal; background-color: #00A3E1; color: #fff;">
                          {content:st:value}
                        </th>
                      {if:elseif content:st:row_id == "2"}
                        <td data-id="{content:st:column_id}"  center;">
                          {content:st:value}
                        </td>
                      {if:elseif content:st:is_last_row}
                        <td data-id="{content:st:column_id}">
                          {content:st:value}
                        </td>
                      {if:else}
                        <td data-id="{content:st:column_id}">
                          {content:st:value}
                        </td>
                      {/if}
                  {/content:st:columns}
                </tr>
              {/insurance_section_data_table}

              </table>
          </div>
        </div><!—/.row—>
      </div><!—/.container—>
  </section>
  <!—End Pricing Table 1-1—>

{/insurance_sections}
#5

Grant Jackson

Thanks for getting back to me. The grid is actually sitting in an EE4 Fluid Field.

When I implemented the above code, everything broke.

Realized I didn’t include the full section of code. This is it below:

{insurance_sections}
    {insurance_sections:insurance_section_data_table}

    <style type="text/css">
        .table>tbody>tr>td {
            padding: 8px 12px;
        }
    </style>

    <!-- Start Pricing Table 1-1 -->
    <section class="content-block">
        <div class="container">
            <div class="row">  
                <div class="col-md-12">
                    <table class="footable table table-stripped" data-sorting="false"  center; font-size: 14px;">

                    {content prefix="content:st:"}
                        <tr data-id="{content:st:row_id}" class="{switch='footable-odd|footable-even'}">
                            {content:st:columns}
                                {if content:st:is_first_row}
                                    <th data-id="{content:st:column_id}"  center; font-weight: normal; background-color: #00A3E1; color: #fff;">
                                        <strong>{content:st:value}</strong>
                                    </th>
                                {if:elseif content:st:row_id == "2"}
                                    <td data-id="{content:st:column_id}"  center;">
                                        {content:st:value}
                                    </td>
                                {if:elseif content:st:is_last_row}
                                    <td data-id="{content:st:column_id}">
                                        <i>{content:st:value}</i>
                                    </td>
                                {if:else}
                                    <td data-id="{content:st:column_id}">
                                        {content:st:value}
                                    </td>
                                {/if}
                            {/content:st:columns}
                        </tr>
                    {/content}

                    </table>
                </div>
            </div><!-- /.row -->
        </div><!-- /.container -->
    </section>
    <!-- End Pricing Table 1-1 -->

    {/insurance_sections:insurance_section_data_table}
{/insurance_sections}
#6

BoldMinded (Brian)

I think your content prefix variable is incorrect, you don’t need to add prefix=”content:st:”, just “st:”

This is what is working in my local env.

{exp:channel:entries entry_id="51"}
{fluid}
    <table>
    {fluid:simple_table}
     {content prefix="st:"}
        <tr switch="{switch='odd|even'}">
            {st:columns}
                {if st:is_first_row}
                    <th data-id="{st:column_id}">
                        {st:value}
                    </th>
                {if:elseif st:is_last_row}
                    <td data-id="{st:column_id}">
                        <i>{st:value}</i>
                    </td>
                {if:else}
                    <td data-id="{st:column_id}">
                        {st:value}
                    </td>
                {/if}
            {/st:columns}
        </tr>
        {/content}
    {/fluid:simple_table}
    </table>
{/fluid}
{/exp:channel:entries}
#7

BoldMinded (Brian)

Closing this b/c its been 3 weeks with no reply and I’m pretty certain the template example provided should be the solution.

Login to reply