Jump to content

Search the Community

Showing results for tags 'filter'.

  • 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 enables Selectize (which is bundled with the PW core) on all Select and AsmSelect inputfields in the PW admin. As described below in the readme, Selectize is initialised/destroyed as the revelant select is focused/blurred in order to support select options that change after the page is loaded. Therefore Selectize is styled to match the AdminThemeUikit select as closely as possible to minimise the visual change as the select is focused and blurred. I'm developing on Windows so I'm not sure how the module will render on other operating systems. It doesn't help that the PW admin uses different fonts depending on the OS - I wish PW would bundle its own webfont for a standardised appearance everywhere. Incidentally, I was a bit disappointed with the state of the Selectize project. I had to fix or work around a number of bugs and shortcomings, including things you would think would just work out of the box such as disabled options, matching the width of the replaced select, or the standard select behaviour where a selection is required when there is no empty option. The Selectize issues repo is full of arbitrarily closed bug reports and pull requests and there are no updates for the last 6 years. I've tried to catch everything that would affect this module but I wouldn't be surprised if there are still some bugs. Selectize All Enables Selectize on all InputfieldSelect and InputfieldAsmSelect fields in the ProcessWire admin. The module activates Selectize on the <select> element when it is focused, and destroys Selectize when the element is blurred. This allows Selectize to work on selects where the options are changed dynamically after page load depending on other field values, e.g. the "Select File" field in the CKEditor link modal or a dependent select in Page Edit. Only AdminThemeUikit is tested and supported. Usage In the module config you can choose if Selectize should be used with InputfieldSelect, InputfieldAsmSelect, or both. If you want to disable the module for a specific Select or AsmSelect inputfield you can hook SelectizeAll::allowSelectize. This method receives the Inputfield object as the first argument. Example: $wire->addHookAfter('SelectizeAll::allowSelectize', function(HookEvent $event) { $inputfield = $event->arguments(0); // You can also get any associated Page and Field objects via $inputfield->hasPage and $inputfield->hasField // Disable the module for the inputfield named "template" if($inputfield->name === 'template') $event->return = false; }); https://github.com/Toutouwai/SelectizeAll https://processwire.com/modules/selectize-all/
  2. Hello, I have a separate sort dropdown and filter section. This is very similar to the processwire demo - https://demo.processwire.com/search/?sort=parent.name I also have the same "issue" if you would call it that where i can sort or I can filter, but I can not do both. This is because the url changes. So a sort URL may look like: website.com/subpage/?sort=random and a filter like: website.com/subpage/?placement=x&channel=y_z I'm looking to be able to sort and filter. So if I change the sort, it won't remove the current filter and vice versa. I have the sort dropdown running off one bit of JS and the filter on another with examples of both below: This is sort JS $(document).ready(function() { $(".sort-select").on("change", function() { document.location.href = location.pathname+"?sort="+$(this).val(); //console.log(location.pathname+"?sort="+$(this).val()) //console.log(location.search) }); }); This is filter JS document.querySelector("form").onsubmit=ev=>{ ev.preventDefault(); let o={}; let noPage = window.location.pathname.split("/").slice(0,-2).join("/") + "/"; ev.target.querySelectorAll("[name]:checked").forEach(el=>{ (o[el.name]=o[el.name]||[]).push(el.value)}) if(noPage.length > 1){ document.location.href = noPage+"?"+Object.entries(o).map(([v,f])=>v+"="+f.join("_")).join("&"); }else{ document.location.href = location.pathname+"?"+Object.entries(o).map(([v,f])=>v+"="+f.join("_")).join("&"); } } This is my input build within the func.php doc: $selector = ''; // Get the inputs, sanitize and whitelist. Then create an array, then replace _ for | in array for selector filter. Output selector if($input->get->sort){ $sorted = $input->get->text('sort'); $input->whitelist('sort', $sorted); //$selector = $selector .= ",sort=$sorted"; } if($input->get->channel){ $channel = $input->get->text('channel'); $input->whitelist('channel', $channel); $chanArray = explode("_", $channel); $chan = $channel = str_replace('_', '|', $channel); $selector = $selector .= ",ab_channels=$chan"; } if($input->get->content){ $content = $input->get->text('content'); $input->whitelist('content', $content); $contArray = explode("_", $content); $cont = $content = str_replace('_', '|', $content); $selector = $selector .= ",ab_content=$cont"; } if($input->get->brand){ $brands = $input->get->text('brand'); $input->whitelist('brand', $brands); $brandArray = explode("_", $brands); $brand = $brands = str_replace('_', '|', $brands); $selector = $selector .= ",ab_brand=$brand"; } if($input->get->style){ $styles = $input->get->text('style'); $input->whitelist('style', $styles); $styleArray = explode("_", $styles); $style = $styles = str_replace('_', '|', $styles); $selector = $selector .= ",ab_creative_style=$style"; } if($input->get->ugc){ $ugcs = $input->get->text('ugc'); $input->whitelist('ugc', $ugcs); $ugcArray = explode("_", $ugcs); $ugc = $ugcs = str_replace('_', '|', $ugcs); $selector = $selector .= ",ab_influencer=$ugc"; } if($input->get->place){ $placement = $input->get->text('place'); $input->whitelist('place', $placement); $placeArray = explode("_", $placement); $place = $placement = str_replace('_', '|', $placement); $selector = $selector .= ",ab_placement=$place"; } if($page->template == 'adbank_brand_page'){ $brand = $page->title; $selector = $selector .= ",adbank_brands=$brand"; } $selector = "template='adbank_pages',limit=12,sort={$sorted} " . trim($selector, ", "); Any direction on how to combine these would be really appreciate. I know AJAX may be the best route overall but I don't know how to action that and for time sake trying to get these to both work with page refresh feels more accessible... TIA
  3. Hello all! I am pretty new to PW and now trying to figure out how to build a filter that uses AND logic and includes many fields. With help I have figured out Page Reference fields and Repeaters, but simple Text Filed with dropdown text tags makes me confused. As I think of it, first I need to get the array of given fixed options of Text Tags here: And then I just need to print it out as checkbox form and circle through each page to see if they have the checked value in place of this field. Like what I have with page references: But for the life of me I cannot figure out how to get this list...So if you have suggestions, I would really appreciate it! Best, Kseniia
  4. Hello, I can't understand how this destructive filter() work. Here's my code (with annotations to explain my issue) : $teamPlayers = $pages->find("parent.name=players, team=$team"); bd($monster->name.':'.$teamPlayers->count()); // There should be 24 players in my team (which is the case on first call) foreach ($teamPlayers as $p) { $result = $p->child("name=tmp")->tmpMonstersActivity->get("monster=$monster, bestTime>0"); if ($result) { $p->bestTime = $result->bestTime; } else { $p->bestTime = 0; } } $teamPlayers->filter("bestTime>0")->sort("bestTime"); // I want to return only the list of players having a best time on this monster return $teamPlayers; My problem is that after several calls (for all monsters) the number of players in the team is not 24 but 1… I guess the $teamPlayers never resets and I can't understand why line 1 doesn't start with 24 again… If I code this for the 2 last lines, it works : $teamMates = $teamPlayers->find("bestTime>0")->sort("bestTime"); return $teamMates; But I would like to understand what's going on with my 1st version (I guess it is the destructive aspect of filter()) ? So if someone could take a little time to explain, I would appreciate ?
  5. Hello There, I have saw a post that was covering event-calendar with php, ajax and js. That was showing a monthly overview when I click on a "month" button or when I switch the month. And show the events on one particular date when I pick a day. Also, most events are kind of exhibitions and so they have a start date and an end date much later, and occur on each day in-between as well. So on the template I put two date picking fileds date_start and date_end. Is there an elegant way to select the events using the API? If yes, kindly help me out. Thanks in Advance Regards:
  6. Hi, i need some help with the filtering based on the Skyscrapers demo/func. I´m not that great with php so be patient. My structure looks like this Youtube videos > Youtube channel > Video on the video template (youtube_channel_video) i have multiple drop down fields and other fields that i would like to filter on the front end. I also have other pages that need this functions with search/filter etc but with different filters. This is the code i have in my search-form.php. Right now i experimenting with the field/option (category) that every video have in their template. The first filter (youtube_channel) works but im trying to get the category filter to work. <div id='skyscraper-search' class='uk-panel uk-panel-box xuk-panel-box-primary uk-margin-bottom'> <h3 class='h3'>Youtube videos</h3> <form class='uk-form uk-form-stacked' method='get' action='<?php echo $config->urls->root?>search/'> <div class='row'> <label class='uk-form-label' for='search_keywords'>Keywords</label> <div class='uk-form-controls'> <input type='text' class='uk-form-width-large' name='keywords' id='search_keywords' value='<?php if($input->whitelist('keywords')) echo $sanitizer->entities($input->whitelist('keywords')); ?>' /> </div> </div> <div class='col-6'> <div class='row'> <label class='uk-form-label' for='youtube_channel'>Youtube channel</label> <div class='uk-form-controls'> <select id='youtube_channel' name='youtube_channel' class='uk-form-width-large'> <option value=''></option> <?php // generate the youtube_channel options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_page") as $youtube_channel) { $selected = $youtube_channel->name == $input->whitelist->youtube_channel ? " selected='selected' " : ''; echo "<option$selected value='{$youtube_channel->name}'>{$youtube_channel->title}</option>"; } ?> </select> </div> </div> </div> <div class='col-6'> <div class='row'> <label class='uk-form-label' for='category'>Category</label> <div class='uk-form-controls'> <select id='category' name='category' class='uk-form-width-large'> <option value=''></option> <?php // generate the category options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_video") as $category) { $selected = $category->youtube_video_category == $input->whitelist->youtube_video_category ? " selected='selected' " : ''; echo "<option$selected value='{$category->youtube_video_category}'>{$category->youtube_video_category->title}</option>"; } ?> </select> </div> </div> </div> <div class='uk-margin-top'> <button type='submit' id='search_submit' class='uk-button uk-button-primary' name='submit' value='1'> <i class='uk-icon-search'></i> Search </button> </div> </form> </div> This is my search.php <?php namespace ProcessWire; $selector = ''; $summary = array( "title" => "", "youtube_channel" => "", "category" => "", "country" => "", ); if($input->get('youtube_channel')) { $youtube_channelName = $sanitizer->pageName($input->get('youtube_channel')); $youtube_channel = pages("/youtube-videos/$youtube_channelName/"); if($youtube_channel->id) { $selector .= "parent=$youtube_channel, "; $summary['youtube_channel'] = $youtube_channel->title; $input->whitelist('youtube_channel', $youtube_channel->name); } } foreach(array('category') as $key) { if(!$value = $input->get($key)) continue; else { $value = (int) $value; $selector .= "$key=$value, "; $summary[$key] = $value; $input->whitelist($key, $value); } } if($input->get('keywords')) { $value = $sanitizer->selectorValue($input->get('keywords')); $selector .= "title|body|category%=$value, sort=title"; $summary["keywords"] = $sanitizer->entities($value); $input->whitelist('keywords', $value); } $videos = findSkyscrapers($selector); $browserTitle = 'Youtube video search - '; foreach($summary as $key => $value) { if($value) { $key = ucfirst($key); $browserTitle .= ucfirst($key) . ": $value, "; } else { unset($summary[$key]); } } region('browserTitle', rtrim($browserTitle, ', ')); region('content', files()->render('./includes/search-summary.php', array('items' => $summary)) . renderSkyscraperList($videos) ); This is my skyscraper-list-item.php file <?php echo " <div class='col-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 col-xxl-4 col-xxxl-4 bmar10'> <div class='youtube_search_holder'> <a data-fancybox data-autoclose='true' data-width='1500' data-height='844' data-height='360' href='{$skyscraper->youtube}autoplay=1'> <div class='youtube_thumbnail_placeholder'><img src='{$skyscraper->youtube_thumbnail->url}' class='youtube_thumbnail_image w-100'> <div class='playicon'></div></div></a> <div class='youtube_search_thumbnail_content'> <div class='h6 text-uppercase green tmar3 title'><a href='{$skyscraper->parent->channel_url}' target='_blank' title='{$skyscraper->parent->title}'>{$skyscraper->parent->title}</a></div><div class='text-uppercase white h3 limit'><a href='{$skyscraper->youtube}' data-fancybox data-width='1500' data-height='844' data-height='360'>{$skyscraper->title}</a></div> <div class='h5 text-uppercase gray date'>{$skyscraper->youtube_video_publishdate}</div> <span class='white h7'> {$skyscraper->youtube_video_category->title} {$skyscraper->countries->title} {$skyscraper->competition->title} {$skyscraper->competition->parent->parent->title} {$skyscraper->armwrestler_competition_gender->title} {$skyscraper->armwrestler_arm->title} {$skyscraper->armwrestler_age_category->title} {$skyscraper->competition_weight_class->title} {$skyscraper->competition_video_match->title} {$skyscraper->videotags} </span> </div></div></div> "; ?> This is the front end right now (no styling ? In the category filter, right now there is multiple categories with the same name, i would also like to restrict it to just one result per category. Please help!
  7. Hi all, I've set up a filter on my product-page, which I then use to...filter my products! – I've got pagination set up, and 30 items per page. – When I active the filter it works perfectly (in my opinion). Here's what I'm struggling with though: When I'm on another page (filtered as well/or the total overview) and I put my GET request in for the filter, it gives back the result, but still with the page-number there. In some cases, this is no problem – like a A-Z or Z-A filter, but others (say, per location) I might have less pages. Visual/code ref: (I DO have 3 pages of authors, but I don't have 3 pages from London) url: books/page3?author=ascending url: books/page3?studio=london The current setup for my pages that get rendered are as follows: $allbooks = $pages->find("template=book, sort=$sort, $q, $tagged, $select_studio, start=0, limit=$limit"); As you can see I have the start=0 in there, but I read that's for the start of the pagination, not so much where it'll drop me in the search results. $q, $tagged and $select_studio are all empty values, unless they're returned from the GET request To repeat it, in it's most simplest form: When I click a filter, and a GET request is done, I want to 'reset' the page-number to 0, and get my results... Perhaps I'm missing something obvious, but I'd be really grateful to have your input.
  8. Hi there, I have a bit of trouble on filtering correctly some event pages by some selectors... I do have the following 2 date fields: - start date (fieldname = date) - end date (fieldname = enddate) Some events are a single day event (only start date) - some are a multi day event (end date). Past single day events should not show up. Current multi day events should show up (even if start day is in the past, but end date is future). So I have the following selector: if ($standort == '') { $termine = $page->children("sort=date, limit=10, (date>=today, enddate=''), (enddate>=today)"); } else { $termine = $page->children( "(standort_reference~=$standort), (standort_alle=1), (date>=today, enddate=''), (enddate>=today), sort=date, limit=10"); } This selector $termine = $page->children("sort=date, limit=10, (date>=today, enddate=''), (enddate>=today)"); works fine, but the follwing does not work (all past entries are also shown): $termine = $page->children( "(standort_reference~=$standort), (standort_alle=1), (date>=today, enddate=''), (enddate>=today), sort=date, limit=10"); I have no clue what I'm missing - any ideas?
  9. Greetings, when I give users the user-admin-* permission to administer users who have a certain role, they can indeed see and edit those users. However the filter / column panel does not show in the admin interface. How can I enable the filter functionality for user-admin-* members? ProcessWire 3.0.123 Moritz
  10. Hi! Just started to dig into PW and since I have a small project starting I wonder that how does PW support dynamic forms out-of-the-box? Or perhaps through some module(s)? I'm creating a form(for visitors) that has options such as shape > size > color > availability/product which filter values for the last filter/select option (in this case availability). And is there any form field dependency implemented or is this just a matter of e.g. jquery events that trigger AJAX or visibility when field value is changed?
  11. This is a pretty typical thing. Open a page, it does a $pages query, finds 112 things and I list them on the page. There is pagination too, 20 per page. I want a sort dropdown box so the visitor can change alpha sort or whatever other sorts and filters I eventually use. My first thought is to just refresh the page with a url query like "page/?sort=az" and then adjust the query in the template code. But to do this, it will require a page refresh, which means the sort box goes back to its default, and not sure how it effects pagination. If I do a page refresh, I'll have to keep the sort settings in the session or something, to make sure I always apply correct sort on page load. But at the same time, I've already got the $pages array, it would be much nicer to shuffle it and update the page without a page refresh, rather than run the query over and over again. But then again, the pagination buttons already cause page refreshes, so that is already happening anyway, unless I convert the pagination buttons to also be no-refresh somehow. I figure this is a very common problem, to paginate results and give users a sorting/filtering option. What is the common methods for handling it? Session, url query, ajax? If I just add the sort to the url query, how do I make that work in the pagination links?
  12. Found myself needing to filter repeater items based upon start and end date fields. These fields aren't required, so repeater items with no dates should be included and those with dates (or a just one date -- start or end) should be evaluated for inclusion. I slowly figured out that I was dealing with in-memory filtering (of a RepeaterPageArray) and not a database-driven operation. So, that eliminated the possibility of using or-groups in my selector. I still thought I could use the 'filter' and 'not' functions to get the job done. Turns out the way selectors are handled for in-memory filtering is quite different from database-driven selectors. Here is what I want(ed) to do to filter the dates: // Start date not specified or in the past $repeater->filter('start_time<='.$now); // Not when end date is specified and has passed $repeater->not('end_time>0, end_time<'.$now); The first one worked exactly as expected. The second it where I ran into problems. The 'filter' function (which calls the 'filterData' function) takes a $selector argument. From everything I read about selectors, I assumed that the entire selector would have to match. In other words, each comma represented an 'and' scenario. Turns out that each separate comma-separated-selector in the $selector as a whole gets evaluated independently. In the case of the 'filterData' function, the elements are removed if any one of those selectors matches. Essentially, we have an 'or' scenario instead of an 'and' scenario. In my case above, there was no way for me to filter for a non-empty date AND one that occurs before a given date...at least that I could think of. So, my main question is if the filter (and related) function should operate on the entire selector passed to the function instead of its individual parts in some sequence. That is what I would have assumed a selector to do. In my project, altering the segment of the WireArray::filterData function solved my problem for now. ...at least till I forget about it and overwrite it when I upgrade next. Here is the code I changed within the function // now filter the data according to the selectors that remain foreach($this->data as $key => $item) { $filter_item = true; foreach($selectors as $selector) { if(is_array($selector->field)) { $value = array(); foreach($selector->field as $field) $value[] = (string) $this->getItemPropertyValue($item, $field); } else { $value = (string) $this->getItemPropertyValue($item, $selector->field); } if($not === $selector->matches($value)) continue; $filter_item = false; break; } if($filter_item && isset($this->data[$key])) { $this->trackRemove($this->data[$key], $key); unset($this->data[$key]); } } I would love to hear what you all think. If I have misunderstood something, then I would welcome a different solution. Thanks!
  13. Hello my friends. Today I started working on my recipe website again and it was the turn to show recipes (pages) that has a specific category assigned in a field. In my NowKnow project for categories I used a parent page where inside of it I had the children and everything seemed to be super easy. This time, however, I decided to change the approach so I created a parent page Recipe categories and assigned to it my 'category' template. Inside the parent I added a few categories that I want to be able to select via PageReferrence field 'recipe_category'. The parent template would show all the categories represented by a title and an image - that part is done and works fine. Now what I am trying to achieve is to have a few recipes having the 'recipe_category' field equal to Bakery for example, and then when I point to the category URL to get only the recipes that have Breakfast selected in. From what I know the perfect approach to achieve that would be to use $input->urlSegment as to select the name of the category from the URL and then filter the pages adding to selectors: recipe_category=$category. Following Ryans earlier instructions about the urlSegment and an example found here in the forum, I got this code to fit my fields names: <?php if($input->urlSegment1 == 'category' && $input->urlSegment2) { $name = $sanitizer->pageName($input->urlSegment2); $category = $pages->get("template=categories-list, title=$name"); if($category->id) { $q = $pages->find("template=recipes-inner, recipe_category=$category"); } } ?> After adding the code, I enabled the URL segments for both: 'category' and 'category-list' templates. Browsing the URL for the Bakery category: http://food.pw/category/bakery/ (the domain name is not a typo, but PW is on my local server) I was supposed to get the $category to get the value of 'bakery'. However instead of that I am getting nothing. What am I missing in the big picture as I am sure it is again something silly but I spent almost the whole day trying to figure it out and still got no progress? P.S. trying to change the urlSegment number to 3 did not help either
  14. Note: this functionality is now built into AdminOnSteroids. I'd hate to know how much accumulated time I have spent and how much eye-strain I have experienced over the last couple of years, hunting through the 675 icons in the "all icons" view for the one I want. Today I finally got around to doing something about it. IconsFilter Allows the "all icons" view in InputfieldIcon to be filtered by name. Usage Install the IconsFilter module. When viewing "all icons" in InputfieldIcon (Advanced tab of field/template settings) you can filter the icons by name using the filter input at top right. https://github.com/Toutouwai/IconsFilter @tpr, something that could be merged into AdminOnSteroids?
  15. Hello all. I am trying to find a way to have a query with all pages that were published on a specific date (today for example). I read a few posts where people had a specific date field and were limitting the results by that, however is there a way to filter results without a specific date field? As far as I am able to publish the timestamp using $page->created logically I should be able to filter by the result of it? What is the best way to accomplish a filter for a day, week, month etc.?
  16. Hey All. I tried google but couldn't find anything appropriate. My question is, if there is a module out there that I missed, to get images from Image- or CroppableImage-fields in a very blurred or distorted filtered version? Thanks a lot!
  17. I know that the Topic title is probably confusing(sry for that ). Let me explain my Question: I have two Filters(Main Filter & Detail Filter) like you can see below. When I click on a main filter it gets bold and will be added to the "Meine Auswahl(my selection)" container below the Filters. When I click on the "X" span inside the "My Selection" Container, the selected Filter gets resetted. Now, what I want to achieve is a ajax Filter which changes the php Selector for the for the $pages->find(). For Example: When I come to that page, the selector for the main and detailfilter should look like this: $branches = $pages->find("template=branch"); // Main Filters <?php $genres = $pages->find("template=genre, select_sparte=''"); ?> //Detailfilters (Returns a NullPage so dont show the Detailfilters when none main filter is selected) When I select for e.g Example Filter 1 it should change to this without a page refresh: <?php $genres = $pages->find("template=genre, select_sparte.title='Example Filter 1'"); ?> So that I get the Detail Filters of Example Filter 1 without a page refresh. Is this even possible? When yes how, can you guys show me a direction?
  18. How can I achieve something like this where I can add more Conditions or delete them: Inside this Form where I create Segments for a Mailchimp Account Form processing looks like this: if($this->input->post->createSegment) { $form->segmentnameParam->required = 1; $form->fieldParam->required = 1; $form->operatorParam->required = 1; $form->searchParam->required = 1; $form->match->required = 1; $form->processInput($this->input->post); if(!$form->getErrors()) { $segment_name = $this->sanitizer->text($form->get("segmentnameParam")->value); $field_name = $form->get("fieldParam")->value; $operator = $form->get("operatorParam")->value; $search_value = $this->sanitizer->text($form->get("searchParam")->value); $match = $this->sanitizer->text($form->get("match")->value); $res = $this->mailchimp->call("/lists/segment-add", array( "id" => $list_id, "opts" => array( "type" => "saved", "name" => $segment_name, "segment_opts" => array( "match" => $match, "conditions" => array( array( "field" => $field_name, "op" => "eq", "value" => $search_value, ) ) ) ) )); if($res){ $this->message(sprintf($this->_("Created new Segment called: '%s'"), $segmentnameParam)); } $this->session->redirect("../edit/?id=$list_id"); } }
  19. Hey I'm stuck with a issue how to filter repeater results depending on content. I have a few Option fields where you can select "yes", "no" or then leave it blank "". I got my loop working and I'm able to skip content that has not been set. Now I just need a filter for the loop. <? foreach($pages->get("/content/")->children as $c): ?> <div> <p> <?php if($c->titles) echo $c->titles; ?> </p> </div> <? endforeach;?> I was able to make a if-statement which checked if($c->Selector=="no"): but as it was in the loop, it kinda bugged out. Never got it working either outside the loop... One really hacky way I thought about was using CSS Classes to set classnames, and that way split what is shown and what is not. This is a really bad way as it still loads all the content for each Selector value. What I'm looking for is eg. a filter that every Selector with value "yes" will be looped, others dismissed. Any ideas how to work on with this?
  20. Hi, Working on a festival site which has artists pages and area pages. On the artist page you can associate area pages with that particular artist by way of a PageTable field. On the line up page you can then filter the artists by area. As shown below: <select name="area" onchange="this.form.submit()"> <option value="">All Areas</option> <?php foreach($pages->find("template=area_page") as $a) { $select = $a->name == $input->get->area ? " selected=\"selected\"" : ""; echo "<option$select value=\"{$a->name}\">{$a->title}</option>"; } ?> </select> All working fine but I'd like to be able to only show the areas that actually have artists associated with them. ie. currently some areas are empty so shouldn't appear in the dropdown. I'm sure there must be an easy way to check if the areas have artists but I can't think how to do it. Any help would be hugely appreciated as always.
  21. Hi there, Is there a native way to adjust how a page's name/url/slug is generated as you type? I'd like it to function similarly to WordPress, which filters out stop words like, "a", "to", "the", etc. If there's not a way to do it natively, would you recommend a module that hooks into the event of when a new page is added? A page's name seems like a pretty vital part of ProcessWire. So, I'm a bit hesitant about messing with it at all! What do the seasoned PW developers out there think? I'm I asking for problems by messing with the page name? Thanks! Lauren
  22. Hi folks, I am trying to query (find) pages who have a certain page as a parent, but then filter this result so it only returns the pages listed. I know you can do the following for one: $pages->find('parent=/widgets/')->filter(1020); But how do you do it for many? I thought the below would've worked... $pages->find('parent=/widgets/')->filter(1020|1069|1070|1071|1072|1073|1074|1075|1076)->getRandom(); Thanks, R
  23. Hello, I'm right now fighting to get content filtered by category. Maybe someone can help me... I have set up a hidden page area as filter option: - categories - cat 1 - cat 2 - cat 3 In some pages I'm able so select these categories as filters - work so far perfect. But: How can I filter the pages which have only the selected filters (categories)? I use the following code as the categories should always be shown: <?php $categories = $pages->find("template=category"); echo "<li>" . "<a href='{$page->url}'>All</a>" . "</li>"; foreach($categories as $category) { echo "<li>" . "<a href='{$category->name}'>{$category->title}</a>" . "</li>"; } ?> That shows me all the categories and a click of a category should show the filtered content - works so far but: If a category is clicked which has no pages -> no filter selected, all pages of the parent are shown instead of none. Any idea? Regards, Bacelo
  24. Hi I don't exactly know how to approach this issue. I don't love how tinymce seems to input a space and an when a user types two consecutive spaces into the editor of, for example, the body field (textarea). I'm not exactly sure where the translation from two spaces to " " happens, but since I've noticed that wordpress does a similar thing I assume it is tinyMCE that is the culprit. Doing some googling for tinyMCE and this issue is somewhat of a mess. I was wondering if perhaps it would be better solved in a processwire module, filter, hook, or something else. Ultimately the goal would be to simply keep them as actual plain spaces, or to remove the double spaces after periods and before additional text. I'd appreciate some thoughts on the matter. I should probably do a bit of due dilligance myself and see whether it gets stored in the db or whether the transition happens when processwire outputs the data.
  25. Hello everyone I want to filter all children adicional_hab field (product type) is NULL or empty or has X page What I want is to filter all the pages that adicional_hab field is empty or has selected a value. To translate it into SQL SELECT * FROM adicional WHERE adicional_hab IS NULL OR adicional_hab = 'standard' I tried $adiconal->children("adicional_hab=standard|''"); On the other hand there ay any way to make a print and view the sql query that is running with filters that these apply? Thank you very much, best regards Diego
×
×
  • Create New...