get('sort') returns a string formatted as: "SortColumn[,Order]", such as
Can this be == to "#321" or any string like this? You need to compare a similar string.
Code: Select all
$sort = get("Sort");
if ($sort == "Name,a") {sortby "Created","a";}
elseif ($sort == "Created,a") {sortby "Name","a";}
I'm just pointing you at the right direction. However, this will not work if sort is descending, even if sorted by Created or Name, because then $sort will end with ",d" instead of ",a", and the comparison will fail. You can use gettoken($sort, 1, ',') to get the sorted column, and gettoken($sort, 2, ',') to get the sort order. Then construct necessary comparisons using these values.
Hope this helps.