Update: most of the design specified here has been implemented, and so I'm freezing this page, and the discussion, and starting a new page for improvements to what we have already made. — Pieterh 2009-09-24
ListPages is one of the key modules but needs polishing and extension. This design sketch is for a set of incremental improvements to ListPages and related modules. Normal indicates functionality already present; bold indicates functionality scheduled for next delivery; italics indicate functionality not yet scheduled.
Applies to ListPages, CountPages:
Category selector:
Tag selector:
Created-at selector:
Created-by selector:
Parent selector:
Page type selector:
Range selector:
Offset selector:
Rating selector:
Backlink selector:
Applies to ListPages:
Order criteria:
Property | Meaning |
---|---|
name | Order by page name (numeric if autonumbered) |
fullname | Order by category and page name |
title | Order by page title |
parent | Order by parent name |
created_by | Order by author screen name |
created_at | Order by date created |
updated_at | Order by date updated |
commented_at | Order by date of last comment |
size | Order by number of size |
rating | Order by rating |
revisions | Order by number of revisions |
children | Order by number of children |
comments | Order by number of comments |
watchers | Order by number of watchers |
For example to order by rating in descending order:
order="rating desc"
An advanced use of ListPages lets you create variations of a single list using specially constructed links (consisting of the page link followed by arguments and values. These are mainly useful to invoke new selectors, and change the ordering or display.
You can pass any arguments in the URL by specifying argument="@URL|default-value" as the argument value and then appending "/name/value" to the URL used to invoke the page. If the URL does not contain a value for the argument, the default is used. Arguments that do not have @URL in their value cannot be set via the URL. The default value is optional: if you use only {{argument="@URL"} and do not provide a value on the URL, then the argument behaves as if it was not set.
The two main ways of using arguments-by-URL are (a) to create links to a page explicitly, on another page and (b) to generate links within the ListPages itself, so it will reshow itself with different configurations. Here is a simple example:
[[module ListPages category="@URL|design"]]
%%name%% in category %%category%%
[[/module]]
By default pages are output in the sort order. To reverse the order use:
These page properties would be available both in ListPages content, and in live template content:
Property | Meaning |
---|---|
Page lifecycle | |
%%created_at%% | Date page was created |
%%created_by%% | User who created page |
%%created_by_linked%% | Icon and link to user who created page |
%%updated_at%% | Date page was updated (edited, tagged, parented) |
%%updated_by%% | User who updated page |
%%updated_by_linked%% | Icon and link to user who updated page |
%%commented_at%% | Date of last comment |
%%commented_by%% | User who made last comment |
%%commented_by_linked%% | Icon and link to user who made last comment |
Page structure | |
%%name%% | Page name without category |
%%category%% | Page category if any |
%%fullname%% | Page name with category if any |
%%title%% | Page title |
%%title_linked%% | Link to page showing title as text |
%%parent_name%% | Parent page name without category |
%%parent_category%% | Parent page category if any |
%%parent_fullname%% | Parent page name with category if any |
%%parent_title%% | Parent page title |
%%parent_title_linked%% | Link to Parent page showing title as text |
%%link%% | URL pointing to page |
%%content%% | Page content |
%%content{n}%% | Numbered content section |
%%summary%% | Short content, first paragraph |
%%tags%% | Page visible tags (not starting with underscore) |
%%tags_linked%% | Page visible tags linked to system:page-tags/tag/{tag} |
%%tags_linked|link_prefix%% | Page visible tags linked to link_prefix{tag} |
%%_tags%% | Page hidden tags (starting with underscore) |
%%_tags_linked%% | Page hidden tags linked to system:page-tags/tag/{tag} |
%%_tags_linked|link_prefix%% | Page hidden tags linked to link_prefix{tag} |
%%field{name}%% | Field value from page data form |
%%field_display{name}%% | Displayed field value if different |
Page reporting | |
%%children%% | Number of child pages |
%%comments%% | Number of comments on page |
%%views%% | Number of times page has been viewed |
%%watchers%% | Number of watchers on page |
%%size%% | Number of characters in page |
%%rating%% | Page rating value |
%%revisions%% | Number of revisions to page |
%%index%% | Page index in ListPages output + offset (1 to %%total%%) |
%%total%% | Total number of pages in ListPages output (highest %%index%%) |
%%history%% | Summary of last edits to page |
Current context | |
%%site_title%% | Title of current site |
%%site_name%% | Wikidot Unix name for site |
%%site_domain%% | Active domain name of current site |
%%user%% | Current logged user name if any, else "anonymous" |
%%user_linked%% | Icon and link to current logged user, if any |
%%user_status%% | Returns anonymous, member, moderator, administrator or master-administrator |
%%now%% | Current date taking into account site UTC +- settings |
Property selection:
Output formatting:
Date formatting:
Tag linking:
if syntax is: | "shiny" tag will link to: |
---|---|
%%tags_linked%% | /system-page-tags/tag/shiny |
%%tags_linked|system-page-tags/tag/%% | /system-page-tags/tag/shiny |
%%tags_linked|interesting-list/category/%% | /interesting-list/category/shiny |
%%tags_linked|player:%% | /player:shiny |
%%tags_linked|very_%% | /very_shiny |
%%tags_linked|http://myothersite.wikidot.com/see-also/tag/%% | http://myothersite.wikidot.com/see-also/tag/shiny |
I've done this before and it worked fine. Below is code to put two ListPages for different lists with the MOST basic table structure. WHY does it not work for me? It displays the second lot of results (tags="email") but not the first (tags="call")
Please feel free to add pages to test if need be, I can always delete them later.
The output from this live template can be found here, but you can see on the template that it's all wrong.
Please help, losing mind!
The module generates <div> block, it breaks the table… so integrate the building of the table inside your module using the prependLine="[[table]]"…. and appendLine="[[/table]]" inside the module
Not sure this will help, but try it
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.
Interest fact about the <div>, I revised the code but still no good. Strange this is that I've done this before here, check out the code.
We're not meant to be using this page any more… and questions for help should be directed to the community
Apart from that though, I'll see if I can help:
Try this code:
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Sorry about posting in the wring place. :(
Originally I was trying to put it in a Double Table, but like you said, that won't work!
I did not want it all in just one row, but as more more complex 'double table' was not working I was stripping back the code, trying to find my error.
Tried the code and get the same result. Darn it!
Is there another way to do this?
Open up an image editing program and draw a rough outline of what you want… I'll fiddle around with it and see if I can get it working ;-)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Thanks for that Shane. I'll get it to u tomorrow. :)
Hi Shane,
here we go. Apologies for the shoddy workmanship. :)
Done… though I'm trying to figure out the best way to turn it into an include. That code is going to get very messy once you add code to the rest of the tabs :P
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Pieter, it should be et al, not et all…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Strange, I know this. Thanks for pointing it out.
Portfolio
Why is it that when range="others" or skipCurrent="true" is used simultaneously with separate="false" that the current page is still part of the list?
Why does it matter if you separate the pages or not for this to work?
It's a bug IMO. Reported, will check.
Portfolio
I can't reproduce this, though, do you have a live example of this wrong behavior?
Piotr Gabryjeluk
visit my blog
Yes, I do:
This page has a table that says “Also on this day:”. The first option in the list is its own page.
I recently noticed, the code for range="others" is slightly broken and instead it requires range="other". The fix is already scheduled. In the meantime, try to reproduce this problem with skipCurrent="true".
Piotr Gabryjeluk
visit my blog
skipCurrent="true" works fine now… That's a funny bug!
The fix is scheduled, but when it's released, will we need to edit/save our pages for it to take effect?
ListPages is generated independently from pages, so you don't have to edit&save them. But as the results are cached for some time, you may to wait some time after the fix is there.
Piotr Gabryjeluk
visit my blog
In a _template I wanted to pass %%tags%% to module FlickrGallery just like this:
It failed because %%tags%% are separated by spaces while the module expected commas.
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Do you have idea if at Flickr, tags contain spaces?
Piotr Gabryjeluk
visit my blog
I just tried at flickr: space is actually a delimiter.
Gabrys has all right: by default space is a delimiter when entering Flickr tags but you enter "tags like this" between double quotes.
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Yes, they can, so we must keep the syntax for FlickrModule.
Piotr Gabryjeluk
visit my blog
Are you sure?
I think you can remove the comma delimiter as Gerdami wants. I looked closer at Flicker and while they do allow tags to be created with spaces, you must surround them with double quotes. Flicker then strips out the space(s) when forming the URL.
The Flickr tag :"still life" becomes "stilllife":
http://www.flickr.com/photos/tags/stilllife/
Here is a test page showing that "still life" and "stilllife" tags produce the same results.
http://myfamilyphotos.wikidot.com/sandbox:flickr-tags
As long as we know to tag our pages in a "Flickr friendly" way, we can use %%tags%% with the Flickr module if you change the code to support space-separated tags rather than comma-separated tags.
-Ed
Community Admin
Module FlickrGallery can stay like it is.
However, ListPages could render %%tags%% with commas in between tags, or let us choose the delimiter.
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Good point. It would be nice if there was consistency between all modules on how tags are handled when passed as a parameter. I generally prefer comma-delimited simply because it's what I'm used to from the majority of other software packages I use. Plus, I think it's easier to read the code.
-Ed
Community Admin
As many of you complain about the new passing arguments by URL, which overrides what you have defined in your modules, we decided to put the @URL thing back, but allowing a default value in case you don't have the corresponding /name/value in the URL. The new syntax would be (compatible with old), for example:
meaning: take category from URL, if not there, use "design".
means take category from URL, if not there use the default value.
This should work for every ListPages and CountPages parameter.
I will be updating this page shortly. Page updated. See the "Passing argument by URL" section.
Piotr Gabryjeluk
visit my blog
If I understand how this works correctly, that will be very useful! :)
Currently I have this on my page to set up the default values:
This would mean that I can remove the redirect module =)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
@gabrys, thanks for this. It's a good improvement.
Portfolio
I would like to display a list of the most recent pages created in a particular category in order of newest first WITh the date it was created. BUT I would like the date to be shorter than "25 Aug 2009, 00:32 GMT+1000" perhaps just "25 Aug 2009", what is the best way to code that?
ALSO, I always get confused, acs = oldest to newest desc = newest to oldest, in my example?
The syntax is:
This gives you the date as 17 Sep 2009. A list of the date formats is at http://community.wikidot.com/howto:frontforum-date-variable
I couldn't get the created_at sort order used in your example to work but it appears to default to desc (i.e. newest to oldest). By the way it is asc not acs for ascending.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
Order by ascending is the default — there is no “asc” attribute. If you really must have some sort of way to determine it's not descending, then just:
which essentially turns into ascending.
Thanks guys, all sorted now. :)
Are you sure? Last night I left out the sort order from the attributes and it came back in descending order. In fact it's still there at the bottom of my page here and it's definitely in descending order.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
I think you misunderstood me. If you specify an order, the default is “ascending” unless you add “ desc” to it.
All of those above examples are in ascending order (oldest to newest, lowest to highest).
However, if you fail to specify an order:
Then the order will be automatically set to order="created_at desc"
Thanks, now I understand.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
Me too.
However, I don't think it's clever to have 2 default orders.
gerdami - Visit Handbook en Français - Rate this howto:import-simple-excel-tables-into-wikidot up!
Which module should be used for Page reporting part?
I assume this is the statistics for a certain page, but it does not work (or i don't know how to use it).
For example, I want to use this one:
%%views%% Number of times page has been viewed
And I put it like this:
But I dont get anything…
Here: http://istorijska-biblioteka.wikidot.com/sandbox:sandbox
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
It would work like this I'd expect:
Or if you were to put it into a template:
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
This does not work…
http://istorijska-biblioteka.wikidot.com/sandbox:sandbox
http://istorijska-biblioteka.wikidot.com/sandbox:_template
PS: As a matter of fact, I do not understand what's this for. Is this to list all pages with the number of views for each one, or to have at each page the number fo views for that particular page?
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
@Brunhilda: views is not implemented yet. All italic text in the design page is unimplemented. I've created a new ListPages documentation that should be more clear.
Portfolio
Ups! So that explains everything! :D Thanks, Pieter!
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Instead of %% something_linked%%, why not just %%something_link%% ?
That way it's consistent with %%link%%
Just as %%parent_title%% is consistent with %%title%%
Good idea… though if you'd have mentioned this before the changes were made to the ListPages module….. xD
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Actually %%link%% is not linked, so there's no inconsistency.
Piotr Gabryjeluk
visit my blog
So we need a %%link_linked% then? =) This could get confusing…
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Well, if you really need something like [http://your-site/some-page http://your-site/some-page], I would call this %%link_linked%%. But who needs this?
Piotr Gabryjeluk
visit my blog
Exactly right :)
No, it's not needed as it can be done exactly as you've described. I was half joking / sarcastic. Sorry :)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Yes, yes! A thousand times, yes!
(weneed:100) a %%index%% 1, 2, 3, ... to be used by ListPages when listing results
^^^ Everyone vote that one up!
For consistency with major programming languages, starting at zero (0) might be a better idea, although that might lead to some confusion for newer users. Then again, will new users be using this feature?
My interpretation of this is something along these lines:
Something like iterator support would lead to very powerful uses of ListPages. The above example could be used to sort data evenly into two columns (odd results in left, even results in right).
Or, much more simply:
Maybe I'm a bit ambitious, but…
Great idea gerdami!
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
I am personally against starting with 0. As programmers, you and I think that makes sense. As normal users… It wouldn't be pretty. Just keep it starting with one.
I agree. Though zero is the first number, it doesn't make sense to use it anywhere else but programming.
0 is nothing. That is , a lack of anything, doesn't exist.
1 is something. it exists. it lives!
If only my bank manager would agree. Actually he thinks zero would be an improvement!
Rob
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
I added %%index%% to this page a few days before Gerdami made the weneed. Great minds think alike, or as my mum used to say, "fools seldom differ".
There is no way in Wikidot to do complex logic in page processing (if else etc.) because this makes a mess of caching and without caching, everything stops. This is one of the realities we work with.
So %%index%% would not be usable for splitting into odd/even, calculations, etc. Won't happen. But at least, for numbering, it will be useful.
Portfolio
I would like to see a “reverse” option in the order of ListPages.
Basically, the ListPages behaves as normal by listing the 5 pages. But if the reverse operator is set, then the list is simply turned upside down.
This would be useful, for example, with the Chatroom application.
I'm confused… doesn't created_at (on its own) do that?
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
No, but I can see the confusion.
Look at these pages. Let's assume that each of these pages were created on the month that they are named:
I want those pages, but in the reversed order:
Ah, that makes sense. I think pieter mentioned something like created_at desc desc somewhere else. On the forums, maybe.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
http://forum.wikidot.com/thread:scrollbar-and-order-of-threads-in-this-forum/comments/show#post-583460