Ok, so here’s the situation, I use an extender to create a list of documents to add to Ditto. These documents are already sorted, when I add them to the document property, is there a way I can tell Ditto to leave the sort as is?
Right now, it simply sorts by published date, which screws up the order..
if you want to sort documents as they come into the parameter &documents try this extender:
<?php
if (!function_exists('customsort'))
{
function customsort($a, $b)
{
$pos_a=array_search($a['id'],$GLOBALS['documents']);
$pos_b=array_search($b['id'],$GLOBALS['documents']);
if ($pos_a == $pos_b)
{
return 0;
}
return ($pos_a < $pos_b)?-1:1;
}
}
$GLOBALS['documents']=explode(',',$documents);
$orderBy["custom"][] = array ("id", "customsort");
$ditto->advSort = true;
?>