Jump to content
Pixrael

How to access to a specific repeater item based on a field value?!!

Recommended Posts

I have spent the whole day searching the forum without finding the answer! It seems that the only way to use the repeaters is using FOREACH! I have a template with a repeater field assigned, on the Page I already have several records saved in the repeaters and I need to access the information of one of the repeater items, but in order to select it I need to ask for the current value of one of the item fields.

Ex:

Page
- Repeater Field
--- Item1
----- FieldA = 2
----- FieldB = BAR
----- FieldC = FOO
--- Item2
----- FieldA = 6
----- FieldB = FOO
----- FieldC = BAR

I need to get the FieldC value of the item that has value=2 in the FieldA

????

Share this post


Link to post
Share on other sites

Oh! So easy? !!! .. I'll try it tomorrow at the office. THANK YOU!

Share this post


Link to post
Share on other sites
12 hours ago, elabx said:

$page->repeater_field->get('FieldA=2')->FieldC

It Works! THX!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...