Jump to content

Search the Community

Showing results for tags 'selector'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. This module fulfills a need that's perhaps not common but there have been some requests for it in the past. There's an open request in the requests repo so the features might get added to the core at some point but for now here's a module for anyone who needs it. PageFinder Depth Adds the ability to find and sort pages by the depth of the page relative to the home page. The module requires that the core PagePaths module is installed. Depth of a page in this case means the same thing as "number of parents", so a page that is directly under the home page has a depth of 1, and a child of that page has a depth of 2, and so on. If you already have a Page object you can get its depth with $page->numParents() but the result of this isn't searchable in a PageFinder selector. Installing this module allows you to use selectors like this: $items = $pages->find("depth=2"); $items = $pages->find("template=basic-page, depth>1, depth<4"); $items = $pages->find("template=product, sort=depth"); The keyword "depth" is configurable in the module settings so you can change it to something different if you already have a field named "depth" that the default keyword would clash with. Limitations OR-group selectors are not supported for depth. Searching by depth in an existing PageArray This module only adds features for PageFinder selectors and doesn't automatically add any depth property to Page objects in memory, but you can search within a PageArray using numParents to achieve the same thing, e.g. $items = $my_pagearray->find("template=basic-page, numParents>1, numParents<4"); https://github.com/Toutouwai/PageFinderDepth
  2. Hi all, I try to select children with only checked checkboxes, but I haven't found a way. I want to select from DB (as selector) and not as a loop from PHP. At the moment, I do <?php $homesCategory = $pages->get("id=1016")->children; foreach ($homesCategory as $featuredProperties) { if ($featuredProperties->featured_properties == 1) { ?> So, If I have thousands of homes, I will have to loop through all and present only the featured. I want to select the featured through DB for speed. Something like <?php $featuredProperties = $pages->get("id=1016")->children->get("featured_properties=1"); ?> I know that it does not work,but I use it as an example to explain what I try to do Thank you all
  3. How to merge selectors of different types (string, array, array of arrays, Selectors) and get $selector with some of these types (to pass it to $pages->find($selector))?
  4. Hi all I have a text search based upon Ryans search template. Unfortunately, I can't make it work with Repeater Matrix fields inside repeaters. I have a repeater field called "content_sections" and inside, there's a repeater matrix field called "items". As I understand it, the selector for a textfield inside the repeater matrix should be: content_sections.items.textfield But this does not deliver any results at all. Any ideas anyone? Thanks Roli
  5. Hello, I have the following selector and output which works when I am logged in as an admin and as a guest as well. $pages->get("name=reports")->children()->each("report_meta_details.report_type.title") //Output //Array ( [0] => Global [1] => Global [2] => Global [3] => Global [4] => Global ) Now, The following selector returns different results for Admin and Guest: $pages->get("name=reports")->children("report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title"); //Output for Admin //Array ( [0] => Global [1] => Global [2] => Global [3] => Global [4] => Global ) //Output for Guest //Array ( ) Here, the field "report_meta_details" is a FieldsetPage, the field "report_type" is a page reference (to children of a page called report-type). Now, the first once runs for both the users; and both the users have the access to the templates, as the titles are returned correctly in the first selector. But the second one, the selector is using something that the users have access to but still does not show the results to the Guest. Any reasons why this is the case? All help is appreciated. Thanks! EDIT: I have tried the check_access=0 selector as well. But no effect.
  6. Hi there! And thanks for Processwire! I have an interesting task which i cannot fulfill as i want. Maybe someone could help me please? Let's imagine a simple page structure of this kind: Category 1 + Item 1.1 + Item 1.2 Category 2 + Item 2.1 + Item 2.2 My task is to attach some items to more than one category, at least to show some items on different frontend category pages. With PW, it's a piece of cake. I've just created a field called Items (of type Page Reference) and attrached it to Category template. Since i have lots of items inside each category i preferred to use Page Autocomplete input for my Items field. The pages available for autocomplete are restricted by a very simple selector: template=item It works like a charm. But later i decided to make this autocomplete even smarter and to exclude current category children items from it. I tried to update my selector this way... template=item,parent!=(page) ...and oops, this broke my selector. My autocomplete founds nothing. Sorry, i had to replace the square braces by () because of this forum limitations, i swear i'm using square brackets in real-life selector! What am i doing wrong? And is there any way to include current page info in autocomplete-related selectors? Thanks in advance!
  7. Hi, I created a Field Type: Page and I want to get a Dropdown where all Pages I have in my PW are listed. With custom Selectors it is possible to call Pages e.g. by template. But in my dropdown I cant select this Page. When I am trying to save I will get an error, that this Page is no valid selection. IMHO it depends on the rule of Parent Page that is selected. Are they any ways to get an Array of all Pages i have, without defining a parent page? Greeting from Nuremberg!
  8. Hello! I have a weird situation going on with my selector field, which I can't really get. I create an array of titles as filter using this logic: firstname=Mike|Steve id=123|124|125 title*=Red|Blue|Green This is the field I am logging: It goes in a for loop till it looks like what you see on the screen. So, my code regarding the selector string looks like this: $output = ""; foreach ($allorganisations as $item){ $output .= "$item | "; echo "<div style='color:red;'>//output String://</div>"; echo $output; } $selector_org .= ", title=$output"; I also log the output just after the matched pages are selected to be sure: $matches = $pages->find($selector_org); echo $output; foreach ($matches as $match) { echo " <li><a href='$match->url'>$match->title</a></li>"; } But you can see that it doesn't select all four needed pages, only selects one of them. Yet when I copy this exact selector text and manually put it in my selector, it works great... I even copy extra space and "|" and all that, it is supposed to be identical. I am very confused, what is the difference between the code? foreach ($allorganisations as $item){ $output .= "Institute for Scientific Research in Cosmic Anthropoecology | Institute for Scientific Research in Cosmic Anthropoecology | Stanford Research Institute | Institute for Scientific Research in Cosmic Anthropoecology | Stanford Research Institute | Institute of Clinical and Experimental Medicine | Institute for Scientific Research in Cosmic Anthropoecology | Stanford Research Institute | Institute of Clinical and Experimental Medicine | Cosmists | "; echo "<div style='color:red;'>//output String://</div>"; echo $output; } $selector_org .= ", title=$output"; } ------> If you see where I'm going wrong, please enlighten me. I am very puzzled with this behaviour . :--) Best, Ksenia
  9. Lister Selector A Process module that uses Lister/ListerPro, but with a selector string input instead of the normal InputfieldSelector filters. Features For power users, typing a selector string is often faster and more intuitive than fiddling with InputfieldSelector. It also lets you copy/paste selector strings that you might be using somewhere else in your code. Allows the Lister rows to be sorted by multiple fields (not possible in Lister/ListerPro) Allows the use of OR-groups (not possible in Lister/ListerPro) If ListerPro is installed you can run ListerPro actions on the listed pages - the available actions are defined in the module config. Bookmarks can be configured in the module config and accessed via the flyout menu for the module page. For your convenience you can copy/paste a bookmark string from the note at the bottom of the Lister Selector results. Usage Type your selector string on the Selector tab. The selector is applied when the "Selector string" field is blurred, so hit Tab when you have finished typing your selector. Unlike Lister/ListerPro, you can't sort results by clicking the column headings. Control the sort within the selector string instead. Superusers can jump to the module config (e.g. to create a bookmark) by clicking the cog icon at the top right of the module interface. The module is mostly intended for use by superusers, because in most cases site editors won't understand the ProcessWire selector string syntax. If you want another role to be able to access Lister Selector then give the role the "lister-selector" permission. Only superusers can define bookmarks because in ProcessWire module config screens are only accessible to superusers. Screenshots Process page Module config (when ListerPro is installed) Advanced If for any reason you want to create dynamic bookmark links to Lister Selector for a given selector you can do that like this: /** @var $pls ProcessListerSelector */ $pls = $modules->get('ProcessListerSelector'); // Define selector $selector = "template=foo, title%=bar"; // Define columns (optional) $columns = 'title,modified'; $pls_link = $pls->getProcessPage()->url . '?bm=' . $pls->urlSafeBase64Encode($selector . ':' . $columns); echo "<a href='$pls_link'>My link</a>"; https://github.com/Toutouwai/ProcessListerSelector https://modules.processwire.com/modules/process-lister-selector/
  10. Hey I'm building my first new site in well over a year and am a little rusty on selectors but particularly retrieving sub-fields of selected pages. I am trying to output the meta data of a blog post as follows. [Person Name] is just a field with a Page Reference and simple enough. [Job Title] is the sub-field within the page that was referenced above. I actually have it working with the following: Posted by: <?php if($page->insight_author) { echo $page->insight_author("<a href='{url}'>{title}</a>");} ?> , <?php $roles = $page->insight_author; foreach ($roles as $role) { echo "{$role->staff_role}";} ?> but was wondering how to do this with selector sub-selectors instead. My current code is probably quite 'old school'? Thanks
  11. Hello all, this is a real beginner's question, I guess. Got stuck on how to select the nth child of a page. Couldn't find the right selector at the API cheatsheet or am just to stupid to understand them right. Also searched the forum. What I want to achieve is something like $page->child(2nd); I tried $page->child("start=2"); but the script then just stops there without throwing an error. I'm sure that should be pretty simple but have no clue atm. Thanks in advance gerhard
  12. Hello all, using PW 3.0.148 with the regular site profile for a blog, I got an an empty pagination output when I had a Toggle field in the selector. The Toggle Fieldtype was introduced with https://processwire.com/blog/posts/pw-3.0.139/ . The selector resulting in empty pagination: $posts = $pages->find("parent=blog, sort=-date, limit=10, toggle_field=0"); It worked well, when I replaced the Toggle field with a Checkbox field: $posts = $pages->find("parent=blog, sort=-date, limit=10, checkbox_field=0"); So the prerequisites for the pagination to work are given. The settings for the Toggle field were: Formatted value: Integer Label Type: Yes/No Input Type: Toggle buttons Default selected option: No Thanks for any hints!
  13. Hi there, I have a problem constructing a selector that finds all pages that refer to pages with a specific template. I have pages using an event template and I want to show events based on a specific context. In this example I want to filter the results and only show event pages that relate to a specific template (exhibitions) in their page field related_pages. What I tried: $events = $pages->find("template=event, related_pages.template.name=exhibition"); Unfortunately it does not work (0 results). Same with this: $events = $pages->find("template=event, related_pages=[template.name=exhibition]"); At the moment I am helping myself with the following lines, but I have a strong feeling that there is a more efficient solution: $events = $pages->find("template=event"); foreach($events as $event){ if(!count($event->related_pages->find("template=exhibition"))){ $events->remove($event); } } I really hope that one of you can help me out. Thanks in advance! Flo
  14. The selector in the following code included in a template is returning nothing, however if I take out the compId.resultsdate<={$today} bit, it works fine, although obviously not filtered on the date field. $today = strtotime(date('Y-m-d')); $setImages = $pages->find("template=competitionImage, compId={$page->id}, compId.resultsdate<={$today}, compSubject.name=s, imageRating.title=Merit|Honours,check_access=0"); Here's the results of an example from Tracey Debugger templates_id=79, resultsdate<=1587729600, status<2048 SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_resultsdate AS field_resultsdate ON field_resultsdate.pages_id=pages.id AND (((field_resultsdate.data<='2020-04-25 00:00:00' ) )) WHERE (pages.templates_id=79) AND (pages.status<2048) GROUP BY pages.id Over in my ready.php I have inside a hook that refers directly to the page template that's used for the pages in the page field above: $today = strtotime(date('Y-m-d')) $event->return = $event->pages->find("template=competition,eventEnd>={$today},eventStart<={$today}"); In this case the filtering on date fields (albeit different ones) works fine. Can anyone suggest why the filter on the date subfield of the page field isn't working? Just to confirm, I do have a date value in the field, and it is a date before today. ? The problem may be something blatantly obvious, but I can't for the life of me figure out why the selector is returning no results when I include the date filter.
  15. Hi, I need a selector to find pages that are using the template "poi" and that are having a page reference to a page with the title "Zoo". The page reference field is called poi_type. How would I do this? I tried this: $poi = $pages->find(template=poi, poi_type.title='Zoo'); But it doesnt work because there is no field poi_type.title. /Jasper
  16. I have simple page structure: category subcategory simple-product simple-product simple-product simple-product subcategory .... category2 so Im at category page and running $pages->find("template=simple-product, has_parent=$page, limit=8"); and it returns 0 pages but this returns 4 pages $pages->find("template=simple-product, has_parent=$page"); Can someone explain why limit does not work here? EDIT: So I did some tests and it seems that any limit=n where n is >= actual page count that is possible ... selector return 0 results.
  17. I'm trying to show upcoming calendar posting pages that have an event_start_datetime and an event_end_datetime. The listing should show calendar postings greater than or equal to today (no past events unless it has an event_end_datetime that is within 3 days after today) if the calendar posting has an event_end_datetime and is within 3 days of today it should still show even though the event_start_datetime has passed. Ex. an event that spans Wed-Saturday. If today is Friday, I still want to show the event on my calendar. Here is the code I have tried: $date = date("Y-m-d");// current date $date_start = strtotime( date('Y-m-d') . " 00:00:00"); $date_end = strtotime(date("Y-m-d", strtotime($date)) . " +1 week"); $paginated_calendar_postings = $pages->get("/calendar")->children("template=calendar-posting|community-event,event_start_datetime>=$date_start, event_end_datetime<=$date_end, sort=-event_start_datetime"); But that doesn't return the correct results. I've spent all day searching through the forums, but couldn't find an answer. Any help is appreciated. Also is there anyway to format your selector on multiple lines like this: $paginated_calendar_postings = $pages->get("/calendar")->children( "template=calendar-posting|community-event, event_start_datetime>=$date_start, event_end_datetime<=$date_end, sort=-event_start_datetime"); It would make it easier to read long selectors. When I tried it, it didn't work. I think it even gave the wrong results.
  18. Hello, I have a Page Reference by template radio button field to promote a certain page (only two options), but I'd like to target the page that isn't selected. This would be used dynamically throughout the site. Does anyone know how I could accomplish this? Would I use something like remove() or not()?
  19. Hi there! I'm using some page reference fields to create lists of tags, categories, years, etc.. I'm able to find the pages like so: $pages->find("template=project, {$filter}={$page->title}"); Which dynamically does something like: $pages->find("template=project, tags=Experimental"); Only if the value (the page name, like "Experimental") starts with letters. If it starts with numbers, find returns nothing. Why is this and how can I fix it?
  20. Hi. I want select pages where now between date and end_date or now bigger than date and end_date is empty. I have five tried variants: $start = strtotime(date('Y-m-d') . " 00:00:00"); $results = $page->children("foo=(date<$start,date_end=''),bar=(date<$start,date_end>=$start),sort=-date,limit=12"); $start = strtotime(date('Y-m-d') . " 00:00:00"); $results = $page->children("date<$start,(date_end='',date_end>=$start),sort=-date,limit=12"); $start = strtotime(date('Y-m-d') . " 00:00:00"); $results = $page->children("date_end=''|date_end>=$start,date<$start,sort=-date,limit=12"); $start = strtotime(date('Y-m-d') . " 00:00:00"); $results = $page->children("!date_end|date_end>=$start,date<$start,sort=-date,limit=12"); $start = strtotime(date('Y-m-d') . " 00:00:00"); $results = $page->children("date_end>=$start|!date_end,date<$start,sort=-date,limit=12"); All this variants not worked for me and returned zero results.
  21. I played with the Selectors object and would like to use it for a special use case... That is a custom Selectors object with dummy data converted to an php array to see the structure (Selectors object is a WireArray with "fields" added) Array ( [0] => Array ( [0] => Array ( [field] => seg1 [value] => val1 [not] => [group] => [quote] => [forceMatch] => ) [1] => Array ( [field] => seg2 [value] => val2 [not] => [group] => [quote] => [forceMatch] => ) ) ) But instead of "seg1" the field name is "field" with value "seg1" (= my field name). So I can't search the Selectors WireArray (= custom WireArray with added Selectors objects) with PW "find('seg1=val1')", Is there a way to search with "find()" or build a simple wrapper to make the elements searchable / filterable with find()?
  22. Hello, I'm facing a weird behavior (to me)... Why are these requests not returning the same values ? // Test 01 : not working > returns empty $allPlayers = $pages->find("team=$team"); // Returns the 10 players (1 of them has HP=14, others have HP>15, no players have coma=1) $dangerPlayers = $allPlayers->find("(HP<=15), (coma=1)")->sort("coma, HP"); // Returns nothing ??? // Test 02 : Working as expected $dangerPlayers = $pages->find("parent.name=players, team=$team, (HP<=15), (coma=1)")->sort("coma, HP"); // Returns the low HP player If you can explain this to me, I would appreciate because this is causing me a headache right now ? Thanks !
  23. On a site that lists events, I am using a repeater field 'event_time', which contains two Inputfield Time fields 'event_time_start' and 'event_time_end'. Some events take place multiple times, others just once. Here's an example for the data structure: event1 title: First Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event2 title: Second Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event_time (2): event_time_start: 14:00 event_time_end: 18:00 event3 title: Third Event event_time (1): event_time_start: 07:00 event_time_end: 09:30 First, I'd like to generate a list of all events, sorted by event_time_start, with every repeater item added as an actual event (similar to a SQL JOIN clause). The desired output would be: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event 14:00-18:00 Second Event A selector like $pages->find('template=event,event_time.event_time_start!=,sort=event_time.event_time_start'); would only return each event page once: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event without 14:00-18:00 Second Event Is there a possible alteration of the selector to take all different occurrences into account? Also I'd like to filter for events taking place in the morning, using a selector like: $pages->find('template=event,event_time.event_time_start>=06:00,event_time.event_time_start<=12:00,sort=event_time.event_time_start'); However, this would only return each 'event' page, which then contains also the afternoon version of event2. While I have the impression these are rather simple tasks, I struggle finding a selector-based solution to it. In this example on opening times are some similarities, but it does not deal with multiple occurrences. I'd appreciate your ideas to it.
  24. Reference: PW 3.0.111 and uikit3 based site using the Regular-Master profile. I am trying to add a field that provides a dropdown menu but there are no Options or Selector(s) type available - see attached image of field types available. The following reference under the docs does not appear to be applicable any more: https://processwire.com/api/modules/select-options-fieldtype/ I can't see how to achieve this. Any assistance would be appreciated.
  25. Hi guys, Any ideas on how to get all pages of a certain template that have been created this month? I have tried to test for "created" within the selector and combining it with date("m") but I'm not sure how to go about this? My goal is to set invoice numbers combing an autoincrementing value with each invoice that is created within a given month. Any ideas? Thanks
×
×
  • Create New...