abmcr Posted November 26, 2017 Posted November 26, 2017 I have a field named"testo" (textarea) included in various templates (home, page, post) ; in one of these the template (post) the field "testo" is an input of a repeater field named "pagina_blocco". If a search a word this selector //$q is the search word $matches = $pages->find("testo~=$q"); the selector get the text only if the "testo" field is not included in the repeater, ie only in the home and page template but not if the word is in the field when this is included into the repeater. I have try with a simple SQL directly on db SELECT * FROM `field_testo` WHERE `data` LIKE '%ente%' and this query find 2 rows: but only the row corresponding to a page The 2 pages founded by query And the corresponding templates: the id 61 is a repeater But in the search page only the pages_id=1 is showed by the selector. If i edit the selector in $matches = $pages->find("testo~=$q,template=home|repeater_pagina_blocco14") the search find also the second row , but in the matches result the ID of page in witch the repeater are included is not present..... How it is possible to search into a field included in a repeater? Obvious it is possible with a series of query from the db.. but this is not PW style Thank you
Robin S Posted November 26, 2017 Posted November 26, 2017 5 hours ago, abmcr said: //$q is the search word $matches = $pages->find("testo~=$q"); the selector get the text only if the "testo" field is not included in the repeater, ie only in the home and page template but not if the word is in the field when this is included into the repeater. Try: $matches = $pages->find("testo|pagina_blocco.testo~=$q");
abmcr Posted November 27, 2017 Author Posted November 27, 2017 Your code work fine! Thank you $matches = $pages->find("testo|pagina_blocco.testo~=$q");
adiemus Posted November 30, 2017 Posted November 30, 2017 Hello, I have a similar problem. My repeaters containing pictures. Every picture can have a description (alt attribute). The formatted value is an array of items. Is there a selector to search in this description fields?
Robin S Posted December 6, 2017 Posted December 6, 2017 Welcome to the forums @adiemus The description field is named "description" and you can include it as a subfield of an images field in your selector. So for a repeater field named "repeater" containing an images field named "images" your selector would be something like: $matches = $pages->find("repeater.images.description~=foo"); 1
adiemus Posted December 6, 2017 Posted December 6, 2017 Thank you Robin. The selector works perfect. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now