howto_user (howto_user) wrote in s2howto,

[paidaccount][Digital Multiplex] 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, and reversing the entries on your Friends page, changing them to the order in which they were posted to LiveJournal servers, in the Digital Multiplex (OSWD) layout. This will only reverse the order of entries on each page — navigation will still work in reverse-chronological order. Also, the "Number of entries on the Recent Entries page to display in full" customization property (in the presentation tab of the customization wizard) will affect earlier entries, not latter ones.

This tutorial will replace the function RecentPage::print_body and or FriendsPage::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 count = 0;
    foreach var Entry e (reverse $.entries) {
        if ($count <= $*leading_full_entries) {
            print_entry_full($this, $e, null Color, null Color, false);
        } else {
            print_entry_short($this, $e, null Color, null Color);
        if ($count == $*leading_full_entries and $*leading_full_entries != $*page_recent_items) { print_heading_bar("Other entries"); }

The word "reverse" in orange changes the order of the entries.

Note that the above code will reverse the order of the entries on your Recent Entries page only. If you wish to have this effect on your Friends page (alone or together with your Recent Entries page), you will need to copy and paste the following code:

function FriendsPage::print_body ()
    foreach var Entry e (reverse $.entries) {
        var Friend f = $.friends{$e.journal.username};
        print_entry_full($this, $e, $f.bgcolor, $f.fgcolor, false);

Note that this time the method "print_body" is called from "FriendsPage" rather than "RecentPage", and that the method body itself is different.

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 </a></b></a>skywhisperer for Tabular Indent, with elements borrowed from a previous tutorial by </a></b></a>gamble. Re-written by </a></b></a>camomiletea. Shamelessly cribbed, simplified and reworded in spots by </a></b></a>pauamma for Digital Multiplex (OSWD).


Comments for this post were disabled by the author