Search the Community
Showing results for tags 'order'.
-
Hi, trying to order pages by modified date, date. I can do 'sort=-date_modified, sort=-date' but that will always put the modified date first regardless of actual date order. I just want to coalesce the two fields and sort. Any ideas would be appreciated.
-
Hi everyone ? Is there a way to order the language tabs in the backend? Currently, they seem to be ordered based on the created date (or id?) … ( time passes … ⏰ ?♂️) Just answered my own question. One can reorder the languages in the page tree under admin » languages or directly in the DB » pages » template_id=54 » sord field. Anyone knows if there are side effects when moving the default language from sort 0 to somewhere higher?
-
<?php $Cats=$pages->find("parent=1086, id!=$page, sort=sort"); foreach($Cats as $Cat) { echo " I have a selector that pulls in 4 child pages of a parent and the order is set to reflect the order of the tree. My client has asked that instead of Cat 1 | Cat 2 | Cat 3 | Cat 4 we instead display Cat 4 | Cat 1 | Cat 2 | Cat 3 However, I can't change the sort order in the tree. Can anyone guide me on the correct approach here? Thanks
-
I have a category template and each page can be associated with multiple categories using a page field type. i have this in php : - $categories = $pages->find("template=category, limit=6"); I want to sort the results by the amount of pages each category has, is there a way to do this in a selector or is there a better way of doing this?
-
Hi! I've got a page with text area where user can check some codes divided by space, semicolon or comma. I can use two solutions to search for these codes: First method: $prCodesArray = preg_split('/[\\s,;]+/', $prCodes, -1); $selector = "title=" . implode("|", $prCodesArray) . ", template=pr-code, include=all, limit=100"; $prCodePages = $pages->find($selector); $prCodeCount = count($prCodePages); if ($prCodeCount) { foreach ($prCodePages as $prCodePage) { $content .= $prCodePage->title . " - " . "<span title=\"". $prCodePage->parent->pr_code_group_description . "\">" . $prCodePage->parent->title . "</span> - " . $prCodePage->pr_code_description . "<br>"; } } else { $content .= $prCode . __(' - Not found.') . "<br>"; } Advantages: + it's fast ~0.21s for ~40 codes. Disadvantages: - alphabetical results sorting while I want input order, - doesn't show not found codes. Second method: $prCodesArray = preg_split('/[\\s,;]+/', $prCodes, -1); foreach ($prCodesArray as $prCode){ $selector = "title={$prCode}, template=pr-code, include=all, limit=10"; $prCodePages = $pages->find($selector); $prCodeCount = count($prCodePages); if ($prCodeCount) { foreach ($prCodePages as $prCodePage) { $content .= $prCodePage->title . " - " . "<span title=\"". $prCodePage->parent->pr_code_group_description . "\">" . $prCodePage->parent->title . "</span> - " . $prCodePage->pr_code_description . "<br>"; } else { $content .= $prCode . __(' - Not found.') . "<br>"; } } } Advantages: + sorting like input order, + shows not found codes. Disadvantages: - it's slow as hell ~2.5s for ~40 codes. Is there any solution to join advantages of both methods? Also, as you can see I have to use include=all statement in my find methods and I don't know why. I've used Import Pages from CSV module. All codes (pages) are published and there is no access control on any of them.
-
I have a PageTable field that is updated via a custom module. Pages are updated by deleting them then re-adding but crucially need be re-added in the same order in the PageTable field. If I re-add pages, they go to the bottom of the field (it's a manual drag n drop setting). Is there a way to re-add where the page was previously? Or at the very least I need to maintain the first page in the field. It has a checkbox ticked if it's first so the re-added page could use that to test whether it needs to go first. I just don't know how to set the order of pages in a PageTable field via the api. Any help here much appreciated.
-
Hi, I have an array of Page IDs ($matches) which I'm using in a PageArray ($matches_limit): $matches_limit = $pages->find("id=$matches, limit=$page_limit"); This is working fine but I need to maintain the sort order of $matches, however $matches_limit reorders the $matches (I guess to sort=sort). Is it possible somehow to maintain the order $matches when outputted in the pagearray?
-
PW: 2.7.3 User role: superuser I have a page with a PageTable field. The field worked just fine, but suddenly when I re-order items in the PageTable on that page via drag and drop and hit save, the re-ordering doesn’t get saved and the old item order appears. Very odd … The PageTable on all other pages with the same template work properly. I tried to clone the problematic page, and tried to reproduce the problem, but I couldn’t on the cloned page! it works. I then deleted the original problematic page, and renamed the clone page to match the name of the original one (the cloned page had, of course, the "-1" suffix in the page name). After the renaming, the problem came back! So apparently my ProcessWire installation has a problem with the name of the problematic page (which is "/ueber-uns/" and "/about-us/" [it’s a multi-lingual setup], by the way, so nothing fancy). I have no idea, how I can fix this issue, and I’m pretty nervous because the editors can’t change the appearance of the page due to this issue.
-
I just noticed that the added items in/under "Add New" are sorted by their template-name. As you can see, on the screenshot below, these "names" differ sometimes to their "labels". Kategorie => category Artikel => post Schlagwort => tag For such kind of cases, it would reallynice if we could sort them manually. That we can sort them by their labels or what ever... Artikel => post Kategorie => category Schlagwort => tag As surprising pw is, this is already possible, somehow?
-
I need to save order for elements in global tree after using "page" fieldtype in other page. It's better to look on image attacheted to understand. I wish to know the better and easiest way to solve it or <code> example ! Thanks
-
I'm just having some trouble with my main menu, it's started happening all of a sudden across a few of my processwire sites (completely separate). I'm using MarkupSimpleNavigation to generate the menu. But when i look at the menu the Home (id 1) goes into the second position in the menu rather than the first. But when i login and check again, it's back to normal. The tree structure obviously has Home as the root. <?php $topMenu = $pages->find('id=1|1018|1026|1019|1020|1021|1023, sort=sort'); ?> <?php $treeMenu = $modules->get('MarkupSimpleNavigation'); $currentRoot = $page->rootParent(); echo $treeMenu->render( array('max_levels'=>1, 'parent_class'=>'parent', 'current_class' => 'current'), null, $topMenu ); ?> This is the code i'm using to generate the menu. Any help on this would be great. Thanks
-
Hi, I'm currently experimenting with using the excellent new PageTable field and have been unable to find an answer to this problem. When editing a page using the PageTable field, I am able to manually drag'n'drop the child pages created by the field. However when I save this doesn't seem to have any effect on the children that the PageTable field created in the admin PageList tree. I've tried setting the template with the PageTable field to sort children by 'manual drag n drop' and also tried setting it to sort children by the PageTable field but nothing seems to have an effect. TL;DR I can't get he manual sort order of pages created with PageTable field to be reflected in the sort order of the admin PageList tree. (The order in the admin PageList) (The order in the PageTable field) Thanks for any help with this!
-
$pages->find('parent=/blog/')->last(); This finds the last child by id order, but how can I get the last or first child if I order them by moving them in the admin list of child pages? Basically I want to choose a post to promote maybe by moving the post to the top or bottom of the list of posts in admin. Thanks PS. I know I could choose the id, but I don't really want to have to change the template every time.
-
I've now twice noticed a problem after I deployed a version to a live server. For example the top buttons in Admin. Usually they are in the order: Pages Setup Modules Access Only when I pushed everyting (incl database export) live the order seems to have changed to Pages Modules Setup Access I also noticed a simple selector seems to ignore the sort I used, and used I think the ID for sorting. It was a critical moment so I quick-hacked a sort after the selector got it results, and thus was not able to get the source ot the problem. The production server uses CentOS with Php 5.2.17 and MySQL 5.0.51a Before I lose hours in debugging and testing, maybe anyone has noticed the same issues and already figured out what was wrong?