Jump to content

Search the Community

Showing results for tags 'or'.

  • 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

Found 6 results

  1. Apologies if this has been covered. I tried a search but didn't hit the usecase I'm after. I currently have category pages listing their children products. Someone asked me to put a product in multiple categories, so I created a Page Reference field called prod_othercategories which lets a user pick multiple product category pages. When I try to output a list of products for a category page, I came around to the following selector: $pages->find("prod_othercategories|parent=$page, template=prod_series, sort=title, prod_status_pages!=1554|1559|1560|4242"); Only the first selector item is giving me trouble, but I'm including the entire string in case something is conflicting and I'm not realizing it. The output is currently only outputting matches for "parent" and ignoring prod_othercategories. I tried listing parent first in the selector but it had no effect. Appreciate if someone could help me with this! Thanks!
  2. Hello there! And thanks for Processwire! It may appear a noob question but what about selectors like "field1=val1||field2=val2"? I mean that the page we're looking for should have field1=val1 OR field2=val2 . There's plenty of examples for cases like "field=val1|val2" but it's another case. Practical example: frontpage uder registration. User should enter nick and email, and both of them should be unused by other registered users. It's logical to use something like $userTest = $users->get("nick={$input->post->nick}|email={$input->post->email}"); But this doesn't work. That's the best practice in this case? Thanks in advance!
  3. Hello, I've been working on building a find query and I think I need to be able to do an OR search on multiple selectors, all of which have a number of possible values. The first way I did this was with three queries: // Categories if($page->Categories->count > 0) { foreach($page->get("Categories") as $category) { $category_array[] = $category->name; } $category_string = implode("|", $category_array); $same_categories = $pages->find("template={$page_type}, Categories={$category_string}")->filter("id!={$page->id}"); } // Tags if($page->Tags->count > 0) { foreach($page->get("Tags") as $tag) { $tag_array[] = $tag->name; } $tag_string = implode("|", $tag_array); $same_tags = $pages->find("template={$page_type}, Tags={$tag_string}")->filter("id!={$page->id}"); } // ConnectedClient if(in_array('ConnectedClient', $page->fields)) { $same_client = $pages->find("template={$page_type}, ConnectedClient={$page->ConnectedClient}")->filter("id!={$page->id}"); } if($same_categories->count > 0) $matches->import($same_categories); if($same_tags->count > 0) $matches->import($same_tags); if($same_client->count > 0) $matches->import($same_client); But for some reason, only the first "$matches" seems to stick. So to me, it would make sense to be able to structure a find query like this: $search = $pages->find(" template=post|project, [Categories=one|two|three]|[Tags=yes|no|maybe]|[ConnectedClient=1065] ")->filter("id!={$page->id}"); Does this make sense? I need to find all pages that match [Tags=yes OR no OR maybe] OR [Categories= one OR two OR three] OR [ConnectedClient=1065]. I realize it might turn into a SQL-needed scenario, but given the flexibility of Processwire, the ability to string together a query like this would be super nice. Is there a way?
  4. Hello together, currently I’m working on some kind of enhanced search for pages->find in the FRONTEND and I like to ask if someone has a possible solution or hint on how to build it. My problem is, I like to add search strings with a "+" or "-" in front of word and tell PW what to search and what not based on the input of the user. Example: Let say I have the following page tree Airports — NYC, USA — Miami, USA — Tokyio, Japan — Berlin, Germany Let’s say that all pages have more then one body text field but in one of them is a text that contains the words "Airport" and "Air-condition". User enter the following text into an input field: Airport air +USA -nyc My preferences are: 1) find all Airports (or cities) with the word Airport or air in the title OR in the body text of the pages, also find part of the words like fair or air-condition 2) Filter the results of 1) and find only pages with the word USA inside 3) Filter the results of 2) and show only (exclude) the results with a word like nyc As the result only Miami, USA will be displayed, because it got USA and NOT nyc and in the body text are the words Airport and air-condition. For 1) I used the code (see below) from @Mats suggestion https://processwire.com/talk/topic/10883-search-with-and-string/ It searches part of words in the title and body with OR. But what I’m looking for is, how can I search for pages that have the search term AND the term with a "+" before. It finds me Airport but it should only find Airport if +USA is inside title of body text. And of course, how it is possible to exclude a word, for example with a "-" before the search term. In spoken language it would be: Find anything with Airport or air. Show only results containing the word USA and exclude anything from the results with the word nyc. In general, is it possible to exclude something from the search in pages->find and what could be a good start to code such a search function? Thanks so much in advance! Thomas if($q) { $input->whitelist('q', $q); $qs = explode(" ", $q); foreach($qs as $key => $q){ $qs[$key] = $sanitizer->selectorValue($q); } $selector = "template=print, title|body|body_2|body_3%=" . implode("|", $qs) . ", limit=50"; $matches = $pages->find($selector); }
  5. Hi Guys, I wanted to find all pages which are children of the current page: $rootPage = $page->children(); But I then want to filter out all pages of a few different templates: $rootPage = $page->children('template!=cta-block|puffs-block|table-block'); But also filter out one specific template called company when the pages website textbox has no value: $rootPage = $page->children('template!=cta-block|puffs-block|table-block')->not('template=company, website='); This doesn't work - I have tried a few different variations, but can't get it right. Anybody point out where I am going wrong? Thanks, Craig
  6. I have the following selector: wire("pages")->find("template=news|video, parent|secondary_categories=$page, limit=8, sort=-publish_date, sort=title"); parent represents the parent of the current page $page is the object representing the current page secondary_categories is a field assigned to the "news" and "video" templates, it is of type "Page" and it uses ASMSelect for selecting multiple pages So basically, what I'm telling ProcessWire is: "Get me 8 pages that use either the 'news' OR 'video' template, AND that also have the current $page as their parent OR that have a reference to the current $page within their secondary_categories field". The problematic part is: parent|secondary_categories=$page The OR operator is not working - I'm only getting pages where the parent is $page, and none where $page is in secondary_categories.
×
×
  • Create New...