I'm wikifused
| 1252590792|%a|agohover |
|
1252590792|%Y|agohover |
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
Related pages:
page revision: 7, last edited: 05 Jul 2011 13:24
They need you on the dev team.
I thought you were biologicaly fused with the wikidot server, or something. 0_o
Post preview:
Close preview