Ditto`s orderBy
on 20-Feb-2010 | Comments ( 4 ) Tags: Ditto, Evolution
According to the documentation orderBy is
"An array that holds all criteria to sort the result set by."
An example would be:
[[Ditto? &orderBy=`pagetitle ASC`]]
You can accomplish the same thing using the sortDir and sortBy:
[[Ditto? &sortBy=`pagetitle` &sortDir=`ASC`]]
What you can't do with the above is use multiple criterias to sort your data.
Imagine you want to sort your documents based on the city and country TVs. For this to work you need to specify two sort criterias. With orderBy you can easily do it like:
[[Ditto? &orderBy=`city ASC, country DESC`]]
where city and country are 2 TVs associated with your template.
The orderBy parameter can also be used as a shorthand to sortBy and sortDir.
Do you know any other Ditto tips? Share them below.
Write a comment
Posts: 3
Reply #4 on : Sat February 20, 2010, 14:02:39
Posts: 3
Reply #3 on : Sun April 11, 2010, 09:09:03
Posts: 1
Reply #2 on : Sun April 11, 2010, 09:34:35
Posts: 3
Reply #1 on : Tue April 27, 2010, 17:09:20