howto_user (howto_user) wrote in s2howto,

[paidaccount][Smooth Sailing] Reversing the order of the entries

Paid Accounts Only
The following tutorial requires creating and editing a custom style, which in turn requires a paid, permanent, or early adopter account. Please read What are the paid account benefits? and How do I buy a paid account? to learn about the paid account benefits and how to buy a paid account.

This tutorial describes a simple method for reversing the order of entries on your Recent Entries page, changing them from reverse-chronological to chronological in the Smooth Sailing layout. This will only reverse the order of entries on each page — navigation will still work in reverse-chronological order. Unlike other layouts, Smooth Sailing has a customization option to control entry order on the Friends page, and this tutorial doesn't cover that.

This tutorial will replace the function RecentPage::print_body. This new code will be placed in a theme layer. If you already have a theme layer for this style, you can simply edit it. Otherwise, you need to create one as explained in the Theme Layer tutorial.

You will need to copy the following code into your theme layer, making sure to include everything:

function RecentPage::print_body() {
  var int i = size $.entries - 1;
  if ($i<0) {
      """<div class="entryHolder"><center>$*text_noentries_recent<center></div>""";    
    foreach var int pos (0..$i) {
      var Entry e = $.entries[$i-$pos];

The expression "$i-" in orange changes the order of the entries.

Compile your layer, and it's ready to use. You will need to apply your theme layer via the Customize interface in order for your changes to take effect.

Originally written by skywhisperer for Tabular Indent, with elements borrowed from a previous tutorial by gamble. Re-written by camomiletea. Shamelessly cribbed, simplified and reworded in spots by pauamma for Smooth Sailing.

Tags: - smooth sailing, chronological order, entry order, order of entries, paid accounts only, reversing entry order

Comments for this post were disabled by the author