regesh Posted August 15, 2019 Share Posted August 15, 2019 Can anyone tell me how to find pages in propper way)) Now i solved taks like this //$place = 1036 //$type = 1122 //doctors_office = page field with multiselect by checkbox //direction_category = page field with select field for one value can be choosen foreach ($pages->find("template=doctor") as $doc) { foreach($doc->doctors_office as $item) { if($item->id == $place){ if($doc->direction_category->id == $type){ $list[] = $doc->title; } } } Link to comment Share on other sites More sharing options...
Jo J Posted August 15, 2019 Share Posted August 15, 2019 For a front-end search form? One strategy I often use is concatenating the selector one input field at a time. Just make sure your add your validation. Something like this: $selector = ''; if($place = sanitizer()->selectorValue($input->post->place)) { $input->whitelist('place', $place); $selector .= ", place%=$place"; } if($input->post->doctor) { $input->whitelist('doctor', $input->post->doctor); if($input->post->doctor == '1') { $selector .= ", name=jim"; } elseif($input->post->doctor == '2') { $selector .= ", name=jon"; } elseif($input->post->doctor == '3') { $selector .= ", name=jake"; } } $limit = 12; $template = doctor; $parent = doctors; $selector .= ", sort=sort, limit=$limit"; $selector = "template=$template, parent=$parent" . $selector; $results = pages()->find->($selector); 3 Link to comment Share on other sites More sharing options...
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