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

Support archive

Pulling multiple matrix content from a low variable custom field

seb 12 Apr 2013 16:34 problem, complete

I created an LV group for "funders" that consists of a single row 3 column matrix field.

I made this group a multi-selectable custom field {funders} on one of my publish forms.

In the template I want to pull the variables and their related matrix content that have been selected in the publish form:

{exp:low_variables:pair var="{funders}" multiple="yes"}
<a href="{fund_url}"><img src="{fund_logo}" title="{fund_name}" /></a>
{/exp:low_variables:pair}


This doesn't work though. As each funder has a separate variable field named after them:

eg {fund_logo_ckdn}, {fund_logo_ecf}

So, this works:
{exp:low_variables:pair var="{fund_logo_ckdn}" multiple="yes"}
<a href="{fund_url}"><img src="{fund_logo}" title="{fund_name}" /></a>
{/exp:low_variables:pair}


But it's not a dynamic solution. Especially seeing I'd like to give my client the ability to add their own variables.

So how do I cycle through each of the selected custom field variables pulling content from each of the matrix columns?

Replies

  1. Low 13 Apr 2013 10:32

    If you're using multiple selections in your publish form (selecting one or more vars from the group), then use the var pair syntax (see the docs, bottom example).

    So, if your field name is called {funders}, use something like this should work:

    {funders} 
    {exp:low_variables:pair var="{var}"}
    ...matrix content...
    {/exp:low_variables:pair}
    {/funders}

  2. seb 13 Apr 2013 17:31

    You're a star. Thank you.
    I had seen that in the docs, it just didn't sink in that I had to use {var} as is. I just kept replacing with my var!
    Again, thanks.