drjones

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

1 Neutral

About drjones

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling
  1. @Robin S, that did the trick. Thank you.
  2. Thank you adrian. I'll look into this.
  3. I found a solution for my problem. If anybody want to take this further, feel free to do whatever you want. If you have any suggestions how to optimize this, please tell me. Update: This one does not respect partial loading like pagination, there must be a better solution. <?php namespace ProcessWire; class myHappyModule extends Process implements Module { public static function getModuleInfo() { return array( 'title' => 'My Happy Module', 'icon' => 'sort-amount-asc', 'version' => 001, 'singular' => true, 'autoload' => 'template=admin', ); } public function init() { $this->addHookAfter("ProcessPageList::find", $this, "hookPageTreeFind"); } public function hookPageTreeFind($event) { $page = $event->arguments('page'); $selectorString = $event->arguments('selectorString'); $children = $page->children($selectorString); $a = array(); foreach ($children as $key => $value) { $a[$key] = array($value->name, $value); } sort($a); $pages = array(); foreach ($a as $key => $value) { $pages[$key] = $value[1]; } $sortedPages = new PageArray(); $sortedPages->import($pages); $event->return = $sortedPages; } }
  4. I mean under a branch. That's a good point. You're absolutely right. I am building a webapp to manage code sticks. Every stick has a color, a number and a programmed code. Now have a branch called "Green" with a template named "color". Under that page I have pages that have a template called "stick" with a number as page title (and name) and a field called code. The sticks should be sorted by number in a natural way site wide (that means in page reference fields to). What i try to accomplish is that the numbers are not sorted like that: 1 10 100 101 102 103 104 105 106 107 They should be sorted like that instead: 1 2 3 4 5 6 7 8 9 10 Thank you for the responses.
  5. Hi I don't know if it's me. I have searched the forum and have found some related issues but no valuable answers. I just want to sort the page tree in admin in a natural order, like natsort does. I have experimented with RecursiveIteratorIterator and array_walk_recursive and a usort with strnatcmp. Nothing works as expected. Do you guys have a solution? I just want to sort my pages by page name in a natural way. There has to be a switch for that! Thanks for your help. jones