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

Support archive

Namespacing nested matrix vars?

brettgullan 31 Oct 2012 10:47 problem, complete

Hi,

I have the following nested early-parsed matrix variables in a template:


"h": {
{exp:low_variables:parse var="record_incident_types"}
"{id}": [
{exp:low_variables:pair var="record_hazard_{id}"}
{
"name": "{id}",
"label": "{label}"
}{if row_count < total_rows},{/if}
{/exp:low_variables:pair}
]{if row_count < total_rows},{/if}
{/exp:low_variables:parse}
},


This works except for two problems:

The inner & outer row_count and total_rows variables don't work as they clash with each other;

and

The matrix variables being called within these nested tags have the same field names, so these also clash.

If I change the field names, I can get around the second problem (though I'd prefer not to). But I have no idea how to get around the clashing row_count/total_rows vars.

Is there a way to namespace nested tags, to avoid these clashes? Any other options?

Thanks,

Brett

Replies

  1. Low 31 Oct 2012 11:59

    Have you tried using Matrix' var_prefix parameter?

  2. brettgullan 31 Oct 2012 21:28

    Thanks Low. Exactly what I was looking for. Fixed!