All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

How do you detect if a matrix field has been populated?

Media Surgery 4 Jul 2012 13:54 problem, complete

How do you detect if a matrix field has been populated?

I can get a single field with something like this:

 

{if '{exp:low_variables:parse var="lv_text2"}'!=""}
{exp:low_variables:parse var="lv_text2"}
{/if}



Iv tried number things like:

 
{if '{exp:low_variables:parse var="lv_matrix_test"}'!=""}
{exp:low_variables:pair var="lv_matrix_test" limit="2"}

{if row_count=="1"}
<ul>
{/if}
<li>{image}</li>
{if row_count==total_rows}
<h1>Total rows: {total_rows}</h1>
</ul>
{/if}

{/exp:low_variables:pair}
{/if}

The matrix itself works fine, it's the if conditional that isn't working. Is it the parse tag or the illustrious parse order?

Thanks for your time.

Replies

  1. Low 4 Jul 2012 16:19

    If you turn on early parsing, you can use the variable syntax:

    {if lv_matrix_var != ''} 
    {exp:low_variables:pair var="lv_matrix_var"}
    ...
    {/exp:low_variables:pair}
    {/if}

  2. Media Surgery 4 Jul 2012 16:25

    That's working... outstanding!

    Thought i tried that a number of times but obviously not!

    Thank you, blog post coming on using it all.