1

Hopefully this will be easy to sort.

One of my custom channel fields is a select dropdown.

I have created a low variable matrix field, which contains two columns.

Column 1 is "Name" & Column 2 is "Description"

When displaying the single entry, I want it to show the name & description in my markup, based on what was selected in the custom field.

Not quite sure how to do this.

{exp:low_variables:pair var="lv_custom"}
<h5>Random text to display {name}</h5>
<p>{description}</p>
{/exp:low_variables:pair}

Thats my starting point, but I need to somehow make it match the Name against the name that is selected in the custom field.

Any ideas? Thanks.

or I'm open to a better way of doing it!

EDIT I've scrapped it for now. Think I was over complicating things.

Gone with this instead in my within my channel entries tag...

<h5>Random Text<strong>{custom_field}</strong></h5>
{if custom_field =="Option One"}<p>Description One.</p>{/if}
{if custom_field =="Option Two"}<p>Description Two</p>{/if}
{if custom_field =="Option Three"}<p>Description Three</p>{/if}

Ideally I wanted a way to control the Descriptions within the CP, as opposed to hard coding it, but this works fine.

Thanks!

  • A little confused. How does your Select menu custom field relate to the Low Variables field? Can you elaborate? – Derek Hogue Feb 1 '13 at 4:07
  • Maybe you can add the channel:entries code to your question as well? That will help in understanding what you're doing. – Low Feb 1 '13 at 9:00
  • If you are manually editing the options of the custom field, why not replace <p>Description One.</p> etc with low variables? (Separate text fields, not a matrix field) {if custom_field =="Option One"}{lv_description_one}{/if} – Jason Varga Feb 1 '13 at 14:15
  • Yep, thats an option actually. Might do that. Trying to cut down as much code & hard coded items in my templates as much as possible, so that will help! Thanks! – shorn Feb 1 '13 at 14:27
  • @JasonVarga, we're trying to clean up old, unanswered questions. Since your comment led to the answer, could you repost it as an answer below? Thanks. – Stephen Callender Nov 6 '13 at 18:27
2

If you are manually editing the options of the custom field, why not replace <p>Description One.</p> etc with low variables? (Separate text fields, not a matrix field)

{if custom_field =="Option One"}{lv_description_one}{/if}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.