I'm wikifused
10 Sep 2009 13:53
10 Sep 2009 13:53
10 Sep 2009 13:53
10 Sep 2009 13:53
nav_first.pngFirst: blog:1
My first blog!
Edited: 06 Nov 2011 11:49 by: James Kanjo
Comments: 2
Tags: ads blog css facebook first free myspace program programming wiki wikidot
nav_prev.pngPrevious: blog:48
Wikidot: "Specify Title Only"
Edited: 07 Jul 2011 14:58 by: James Kanjo
Comments: 1
Tags: poll wikidot
Last: blog:77
Wikidot: CSS Per Category
Edited: 04 Mar 2012 05:54 by: James Kanjo
Comments: 3
Tags: programming wikidot
nav_last.png
Next: blog:50
Wikitip of the day!
Edited: 06 Nov 2011 11:53 by: James Kanjo
Comments: 3
Tags: domain tip wikidot
nav_next.png

Today I was wikifused :-(

The new ListPages functions include the capacity to choose the “range” from your pages. That is, choose the pages before or after the current page.

[[module ListPages order="created_at" range="before" limit="1"]]

With the above code, I expected the interpretation to be:

  • List all pages created BEFORE the current page
  • Arrange them in ASCENDING ORDER (oldest to newest)
  • Choose the 1st item (the oldest item)

Based on this logic, to retrieve the first page that is older than the current page, just change the order to descending:

[[module ListPages order="created_at desc" range="before" limit="1"]]

WRONG JAMES!

The ListPages module doesn't interpret that way. Now, as I understand it, the above code works like so:

  • List all pages in DESCENDING order (newest to oldest)
  • Locate the current page in the list
  • Choose the 1st item in the list of pages BEFORE it

Essentially, that code will actually find the newest page… the first code block mentioned will still find the oldest page.


So here's a truth table, to end all wikifusion:

limit="1" range="before" range="after"
order="created_at" Oldest page 1 page newer
order="created_at desc" Newest page 1 page older

λ James Kanjo

Comments:

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
All content on this page is subject to the guidelines outlined here