开发者

Movable Type: MTEntries sort_by="title" doesn't really work

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><MTEntryT开发者_运维技巧itle></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?


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜