On Nov 1, 10:12 pm, The Editor <[email protected]> wrote:
> On Sat, Oct 31, 2009 at 12:18 PM, Markus <[email protected]> wrote:
>
> > I am using a simple blog script that names files this way:
>
> > blog.a.2009.10.31.16.42.the_title
> > blog.b.2009.10.31.14.50.another_title
>
> > What I would like to do now is to sort by {p3}, {p4}, {p5} and so on
> > (in that order). Sorting by creation date that is.
>
> > The result would be blog.a entries and blog.b entries mixed in their
> > order of creation. Any ideas? Should have some offset=2 option in
> > action.search.
>
> Looking at the code, it appears you would need a custom sort function.
> You have the ability to sort by lastmodified, p0-pXX, page, or simple
> data variables.  I think that's all we have capabilities for in the
> core...
>
> To do a custom sort function you write:
>
> function BOLTsortCreationDate($myArray) {
>      sort how you would like...
>      return $myArray;
>      }
>
> In this case your code would look something like:
>
> function BOLTsortCreationDate($myArray) {
>      foreach($myArray as $page) {
>           $p = explode(',', $page);
>           $sortIndex['$page'] = "$p[3].$p[4].$p[5]";
>           }
>      asort($sortIndex);
>      $myArray = array_keys($sortIndex);
>      return $myArray;
>      }
>
> I haven't tried this  but thought I'd take a quick stab off the cuff.
> Give you something to tinker with. Of course in your function you
> would put:
>
> sort=CreationDate
>
> Cheers,
> Dan
>
> P.S. Let me know if you get stuck with this...

Not stuck. With some tinkering I got exactly what I wanted to have.
What's the smartest way to integrate it? I created a plugin... Or
asked differently: Are there other ways to add a function?

http://www.boltwire.com/index.php?p=docs.handbook.functions is not
that helpful... See the last line. It's a self-link. :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to