Search the Community
Showing results for tags 'pages-find'.
-
Hello all, I'm pulling a list of user profile pages I have generated based on a location filed - So far all good. My issue is I want to further filter based on a repeater field value. I have a repeater called "price_list" it contains 2x fields a page reference field called service and a text field called "price" What I want to do is search this list as I am currently but filter the results gathered based on the price field from within the repeater. For the life of me I can't figure out a way of actually doing that Is it even possible?
-
Hi community, i want to add a selector to every pages->find() method. I found this hook solution, and Ryan mentioned this somewhere in this forum. https://processwire.com/api/ref/pages/find/ $this->addHookBefore('Pages::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (and optionally modify them) $selector = $event->arguments(0); $options = $event->arguments(1); /* Your code here, perhaps modifying arguments */ // Populate back arguments (if you have modified them) $event->arguments(0, $selector); $event->arguments(1, $options); }); If i try to add something to the given $selector, the error occurs: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? But the syntax is right, isn´t it? $this->addHookBefore('Pages::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (and optionally modify them) $selector = $event->arguments(0); $options = $event->arguments(1); /* Your code here, perhaps modifying arguments */ $selector.= ", loremipsum_field!=1"; /* <----------------------- */ // Populate back arguments (if you have modified them) $event->arguments(0, $selector); $event->arguments(1, $options); }); What i am doing wrong? Thank you for your advice!
-
I've created a couple pages that hold nothing more than categories - referenced by portfolio pages. The multi-select page fieldtypes work just fine. Now I'd like to find all pages that have category X. Since most items have more than one category, I need selector operators like %= or *=. But these simply don't work. e.g. $cat = $sanitizer->selectorValue($page->title); // works // none of these work: $p = $pages->find("portfolio_categories*=$cat, template=portfolio, sort=-Project_Date"); $p = $pages->find("portfolio_categories%=$cat, template=portfolio, sort=-Project_Date"); $p = $pages->find("portfolio_categories*=$cat"); produce the error messages I've uploaded as attachment below. Do I have a buggy mySQL version installed? Other basic selector queries (foo=bar) work fine...