Ако използвате Ditto и се нуждаете от нестандартно сортиране (имам предвид, че не ви вършат работа:
&orderBy, &sortBy и &sortDir) можете да използвате
extenders
<?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;
?>
за да използвате този скрипт е небходимо:
1. да създадете php файл с име
customsort.extender.inc.php
2. качите файла в: assets/snippets/ditto/extenders
3. използвате:
[[Ditto? &documents=`18, 25, 16, 24, 23` &extenders=`customsort`]]
Подредбата на резултата ще бъде в последователността, която използвате в &documents=``