tags:

views:

23

answers:

1

Hello

Im trying to sort <MTEntries> by title.

I know you can use <MTEntries sort_by="title" sort_order="ascend"> but this modifier some how prioritizes capitalized letters first to the sort. Im not sure if this is a glitch in the system but this modifier should sort by purely the alphabets(caps or no caps) used in the title.

Example:

Template code:

<ul>
<MTEntries sort_by="title" sort_order="ascend">
<li><MTEntryTitle></li>
</MTEntries>
</ul>

I would like to sort these titles alphabetically:

  • APRICOT
  • Aligator
  • ABBEY
  • Apple

If <MTEntries sort_by="title" sort_order="ascend"> is used:

  • ABBEY
  • APRICOT
  • Aligator
  • Apple

But it really should be (and I want)

  • ABBEY
  • Aligator
  • Apple
  • APRICOT

Would someone know how to achive this?

+1  A: 

The reason that they are being sorted in this order is that capitalization matters with string sorts. For example, 'B' would come before 'a'.

You could achieve what you're looking for with use of the Order plugin, since that transforms everything to lowercase before performing the sort:

<mt:order sort_order="ascend">
    <mt:entries>
        <mt:orderitem>
            <mt:setvarblock name="order_by"><mt:entrytitle></mt:setvarblock>
            ...
            <!-- entry display bits here -->
            ...
        </mt:orderitem>
    </mt:entries>
</mt:order>

(Warning: I haven't tested that)

rayners
It worked!Wow didn't know such plugin existed.Thank you
Maca