New option for loadprofile and loadsubprofile: orderby
by
We have added a new option to the loadprofile and loadsubprofile functions: orderby
The orderby option allows you to select profiles or subprofiles in an ascending or descending order, based on the value in a specific database or collection field.
You do this by adding the option as a parameter to the loadprofile or loadsubprofile tag
{loadsubprofile orderby='<fieldname> asc / desc'}
- Specify the field name whereon the ordering must take place
- Then specify the order: 'asc' for ascending and 'desc' for descending.
Example
You have a collection with a field called 'fruit' and some subprofiles. They respectively have the values Banana, Apple, Lemon, Watermelon, Nectarine in this field.
{loadsubprofile assign=loadedfruits multiple=true limit=2 order='fruit asc'}
<ul>
My favorite fruit is:
{foreach $loadedfruits as $loadedfruit}
<li>{$loadedfruit.fruit}</li>
{/foreach}
</ul>
Result (asc):
My favorite fruit is: Apple, Banana
Resultaat (desc):
My favorite fruit is: Watermelon, Nectarine
If you ommit the orderby parameter, the system will automatically fallback on the default behaviour (ascending order on the field ID).