0

I have some entries that have a field group containing two fields, ID and description. I want to know how I can retrieve the description based on the ID. The IDs are unique.

2 Answers 2

3

A simple example would be to use the search: parameter to get the ID:

{exp:channel:entries channel="yourchannel" search:your_id_field="abc123"}
  {your_description_field}
{/exp:channel:entries}
2
  • That parameter should have an additional = sign to be an exact match: search:your_id_field="=abc123" and it's worth mentioning that it can be very slow searching on a lot of entries so be aware of that if you need to scale it large. Commented May 11 at 1:09
  • Absolutely that if you want exact matching. Commented May 12 at 21:31
0

Should be simple enough there are a few ways this can be done.

First is using entry id

{exp:channel:entries channel="yourchannel" entry_id="1"}
  {description}
{/exp:channel:entries}

Second is using an if statement

    {exp:channel:entries channel="yourchannel"}
{if entry_id="1"}
  {description}
{/if}
{/exp:channel:entries}

Third is if you are on the detail page for the one you want to search it should select the correct item.

{exp:channel:entries 
    channel="yourchannel" 
    limit="1" 
    }{description}{/exp:channel:entries}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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