Jump to content

Search the Community

Showing results for tags 'sorting'.



More search options

  • 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
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


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 19 results

  1. Is there a way to add a (new or existing) page to the top of the asmSelect list? By default they're added at the bottom.
  2. Hi, First, this is production realestate site, big one. So please, if any chanse to fix this without touching database, it would be great I have field "pstatus" as a PageReference, In the tree under Status as children: sold unavailable paused In the template "property" I have dropdown were I choose: empty (nothing); sold; unavailable or paused. If you do not choose anything, property will have active selling status. I need help sorting property template in this order: show all empty and than show all sold. 1031 is Status, parent of the sold unavailable and paused. $status = $pages->get('1031')->children('sort=pstatus'); $selector[] = "sort=price, pstatus!=$status"; But I got there all except from status. I need to list "sold" too.
  3. 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.
  4. Hi, I wonder if there is any way to set a template to sort it's children by more than one column. I love that we can set this at either the template or page level, but I'd like to be able to sort by two columns as in SQL 'sort by column1, column2' If there's not a solution, I'll consider doing a module for it. Thanks.
  5. Hello everyone, i guess my php knowledge is not good enough to find a solution for the following problem: I'm building a website where i have projects. Each project has tags like "webdesign, responsive, cms, print, flyer" etc. At the end of a project i want to recommend other projects, which have similar tags. I want to limit the recommendations to three other projects sorted by the hightest amount of same tags. This is how far i got: I'm using <?php $interessantes = $pages->find("tags=$page->tags, id!=$page->id"); ?> to find other projects with the same tags, excluding the page i'm already on. Then i'm using three foreach-functions to go through the projects i found, the tags they have and compare them with the tags of the project i'm looking at. If i have two identical tags, i count up a variable. <?php // Projects i have found foreach($interessantes as $interessant): $i = 0; // Tags of the projects i have found foreach($interessant->tags as $tag): // Tags of the project i'm looking at foreach($page->tags as $tagreferenz): if($tag == $tagreferenz): $i++; endif; endforeach; endforeach; endforeach; ?> You can see what it looks like in the screenshot with a bit of HTML. I marked the tags of the current project green and the identical tags of other projects red with the amount of hits below. So in this example i would want to have three projects with three similar tags and get rid of those with only two and one. I guess i have to put my pages into an array (with the number of hits?), sort them and echo them with "limit=3"? Unfortunately i have no idea how to do this. You probably have an even better/shorter solution. Links to other topics are welcome to and i'll try to get my head around it. If you need further explanation, i'll try my best. Best regards
  6. Sorting with different selectors, pagination works good When I logged in as Admin. But for visitors it does not work. I think it is cache problem. Any idea ? Thank You. https://cdeniz.com/kutuphane/kisiler/?sort=dogumtarihi
  7. I have a situation where a pagearray appears to lose its sort order. 1. template xyzzy.php fetches a pagearray with code similar to: // in an external include file function get_pages($selector) { $found = wire('pages')->find($selector); wire('log')->save('fubar', count($found)); return $found; } // in the template xyzzy $pa = get_pages($some_selector); $pa->sort('-timestamp'); 2. main.inc is appended to the template. in main.inc an additional file is included, './layouts/xyzzy.php' 3. './layouts/xyzzy.php' then references $pa as such: <? foreach($pa as $p): ?> // do stuff with $p // log for debugging wire('log')->save('xyzzy', $p->name); <? endforeach ?> 4. The $pa that './xyzzy.php' sees is sorted while the $pa that './layouts/xyzzy.php' sees is NOT sorted. It seems like the PageArray/WireArray got copied at some point but the './layouts/xyzzy.php' file shouldn't have been included until 'main.inc' is appended. What am I missing?
  8. Hi there, I know this topic isn't new but I can't find a valid solution. I'd like to reorder manually my subpages via drag and drop, but it doesn't work. Here's my code: <?php $works = $pages->find("template=visit-detail, limit=10"); foreach($works as $w) { echo "<div class='col-lg-6 col-md-6 col-sm-6 '> <div class='port-item'> <a href='{$w->url}'> <h4>{$w->title}</h4> <p>{$w->visit_subtitle}</p> <div class='primary-photo'> <img src='{$w->slide_images->eq(0)->getThumb('visite-thumb')}' alt='Itineraria'> </div> </a> </div> </div>"; } $pagination = $works->renderPager(); echo $pagination; ?> I'm aware that there was a problem with MySQL version, but hostgator currently uses 5.5.23 or higher. It seems I can only order pages via "sort=-created", do you have any advice? Thanks!
  9. I have a property of a child page that runs through a custom function to get a sort of the pages (hex colors). assuming i can get the page ids of all of the child pages in the right order, is there any way i can run a script to sort these child pages (in the admin), they need to stay manual sort after the script runs so that the users can then make adjustments to the sort... Looked at some threads and the page sort function, but looks like it may require running a sql query to update that sort (?)
  10. Hi there, I have a little problem with a repeater that I'm using for events, containing three fields: start_date, end_date, description On the homepage, I want to display the upcoming two events. So I have to filter out past events, sort by the dagte and set a limit for the output I thought I could do it with something like the following code, but there's no output: $nextevents = $pages->get("template=events")->events->find("end_date>today, sort=end_date, limit=2"); foreach($events as $event) : ?> <li class="future-event"><?= $event->end_date ?><span><?= $event->description ?></span></li> <?php endforeach ?> the template of the repeater is called "events" and the repeater field's name is also "events" I guess it can't be that difficult, but after trying different things and looking through the docs, I still have no idea how to solve it. Would be great if someone can help! Thanks
  11. I'm building a dashboard, based on the dashboard from Kongondo's Blog. In there i have Articles and Widgets. Articles are sorted by some date, but for the widgets i want to be able to use manual drag-n-drop sorting. Widgets are all child pages from a certain parent page. Is this possible and how would i be able to approach this? Would it be possible to build manual sorting into MarkupAdminDataTable or should i use PageTable instead? update: Im looking in to ProcessPageSort to see if i can use that. Seems it needs an AJAX call. update: Changed title of post
  12. I have a series of products which are attached to 'collections' which are their parent pages. I need to be able to output the products by their parents order. At the moment I have this: $products = $pages->find("template=product,stock=1"); which worked fine when I first created the site because all the products were entered in the correct order, but now a new collection has been added that needs to go first. (Parent pages have a different template than the individual products.) I've tried adding sort=sort but as mentioned in the docs it doesn't really produce the desired result. So how would I go about it?
  13. Hey there. So I am currently working out a loop that pulls a list of items from three separate parent pages. This all works perfectly except I would like to change the order that they are pulled in to the loop without re organizing the pages themselves as they are nested under three separate categories. Is this something I could use a selector with and possibly provide the client the ability to manually re-organize the order of the items that are being displayed. $featuredPages = $pages->find('template=Exhibition, Exhibition_Featured=1'); foreach ($featuredPages as $featuredItem){ //doin stuff }
  14. Is there a way to have new children appear at the top of the list of children when they're first created (rather than at the bottom) whilst also allowing the user to do custom ordering? I seem to remember seeing this option somewhere but I can't find it. Perhaps I'm misremembering! Many thanks in advance!
  15. Hi i need to sort pages for upcomming games. so i have this code <?php $Match = $pages->find('parent=1022, sort=date'); $tab = ""; $button = ""; $i = 0; foreach ($Match as $match ) { $date = date("d F", $match->getUnformatted("date")); $time = date("h:i", $match->getUnformatted("date")); $count = count($match); $selectVal = ''; if ($match->transmition == '1') $selectVal = 'tak'; else $selectVal = 'nie'; if ($i == 0) { $button .= "<a class='active {$i}' href='#tab_{$match->id}'>Następny mecz</a>"; $tab .= "<div id='tab_{$match->id}' class='tab active'>"; }else{ $button .= "<a class='{$i}' href='#tab_{$match->id}'>Poprzedni mecz</a>"; $tab .= "<div id='tab_{$match->id}' class='tab'>"; } if ($match->logo1) $logo1 = $match->logo1->size(77,77)->url; else $logo1 =''; if ($match->logo2) $logo2 = $match->logo2->size(77,77)->url; else $logo2 =''; if($date && $time) $tab .= "<dl><dt>Kiedy?</dt><dd>{$date} {$time}</dd></dl>"; if($match->team_name2) $tab .= "<dl class='teamname'><dt>Z kim gramy?</dt><dd>{$match->team_name2}</dd></dl>"; if($match->text_input) $tab .= "<dl><dt>Gdzie?</dt><dd>{$match->text_input}</dd></dl>"; if($match->text_input2) $tab .= "<dl><dt>Jaki typ rozgrywki?</dt><dd>{$match->text_input2}</dd></dl>"; if($match->text_input3) $tab .= "<dl><dt>Jakie bilety?</dt><dd>{$match->text_input3}</dd></dl>"; if ($selectVal) $tab .= "<dl><dt>Czy będzie transmisja?</dt><dd>{$selectVal}</dd></dl>"; if ($logo1 && $logo2) { $tab .= "<div class='clear'></div>"; $tab .= "<div class='logos clearfix'>"; $tab .= "<div class='logo1'><img src='{$logo1}' alt='' /></div>"; $tab .= "<div class='vs'>VS</div><div class='logo2'><img src='{$logo2}' alt='' /></div>"; $tab .= "</div>"; } $tab .= "</div>"; $i++; if($i > 1) break; } ?> <section class="next-match"> <div class="container"> <div class="span4"> <div class="tabs clearfix"> <?php echo $button; ?> </div> <div class="tab-wrap"> <?php echo $tab; ?> </div> </div> </div> </section> now i need first $tab to be the closest next date from today's date, in the second $tab i need to display the last one played from today's date. The first one is working fine showing exacly what i need, just cant figure out how to dispaly the last one played. Any idea how can i achive this ? Regards Paweł
  16. Hi, Is there an easy way to add rules to the "sort" selector, or otherwise manipulate search results directly with PHP? I'm trying to sort results by Page title, but I want to ignore any initial "the", "an", or "a." I know I can export the results into an array, manipulate them, and then display them, but that would disrupt pagination, and seems clunky. Surely there's an elegant solution? Thanks! -evan
  17. Hi all, I have a database table of about 150 items and growing. For each item there are about 20 data points, so the table has 150 rows and 20 columns. The data in the columns is just a digit from 0 to 9. The "item" name column is just a text field, linked to a URL. I need help with two different UI's: On the visitor side, I need them to be able to select a few (say 4 or 5) data points (columns) that are most relevant to their search, so the the table will be re-ordered to display the items that have the highest total numerical value (selected data columns added up) at the top. On the back end, I need a simple data-entry panel for adding new items. One field for the name, 20 labeled fields for their respective data points. Of course it should automatically populate the publicly-visible page. So, can you recommend any particular modules or other products or approaches to these needs? I already have PWire installed with no hassle, but I have not gotten much further than that yet. Thanks!
  18. Hello! I'm having a strange issue in only one of my PW sites with the manual sorting of pages. I can't sort pages manually in the admin anymore! I have a group of pages in the site that have manual sorting in their parent's settings and PW let's me drag drop pages around. Everything stays in place the way I want, and no errors arise, but when I reload the page the sort change are not saved and everything stays in the same same. Maybe I'm missing something here cause I'm stuck!! I had some issues with this server provider (in my last two forum messages) so I am betting this can be the cause. I'm using PW 2.2.0 (should I try an upgrade?) Any clues?
  19. I started to write this post and at the same time figured out the answer from source. Decided to post my problem, since this is something that is currently missing from cheatsheet (not sure if everything should be there). I create page from API and I need to set that it children get sorted by custom field called candidate_number. How to set that from API? This is how: $p->sortfield = $fields->get('v_candidate_number');
×
×
  • Create New...