Skip to content

Instantly share code, notes, and snippets.

@somatonic
Created March 28, 2012 14:52
Show Gist options
  • Save somatonic/2226823 to your computer and use it in GitHub Desktop.
Save somatonic/2226823 to your computer and use it in GitHub Desktop.
PW search
$words = '';
$q = $sanitizer->selectorValue($input->post->q);
$words = explode(' ', $q);
foreach($words as $word) {
$word = $sanitizer->selectorValue($word);
if($word) $selectorEmergencyContacts .= "title|label_$lang*=$word, ";
}
...
// search for Emergency Contact Addresses, match pages that have this address in "emergency_address_select" page field (in two lines!!!)
$address_matches = $pages->get(1458)->find( $selectorEmergencyContacts . " template=emergency-contact, include=hidden");
if(count($address_matches) > 0) {
// if we found Contacts, we search for objects having this address added through page reference field "address_select"
$matchesA = $pages->get(1010)->find("emergency_address_select=$address_matches, template=object");
$results->import($matchesA);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment