[Mediawiki-l] Easy creation of page sequences

Steve Sanbeg ssanbeg at ask.com
Mon Sep 14 21:35:06 UTC 2009


You could probably make a template like

[[{{#include:index|prev-{{{PAGENAME}}}}}|Prev]] [[{{#include:index|next-{{{PAGENAME}}}}}|Next]] 

Then supress the links at the end by making the first & last pages link back to themselves, 
and avoid duplicate names by indexing the name in multiple sections, i.e.

<section begin="next-First Page"/><section begin="prev-Third Page"/>Second Page....


http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion

On Mon, 14 Sep 2009 23:10:55 +0200, Jean-Marc van Leerdam wrote:

> Hi,
> 
> I have been trying to create a maintainable way of grouping pages together
> and allowing readers to page through them in sequence. Most samples I've
> seen use templates that require you to supply the 'previous' and 'next'
> page. This however results in three page edits to insert a new page
> between two existing pages and does not guarantee that your prev-sequence
> is identical to the next-sequence...
> 
> Being a programmer, that is way too much duplicate and error-prone work
> for me ;-) There must be a better way to do this and I was hoping to solve
> it with a plain MW installation (with ParserFunctions and DynamicPageList
> at the moment).
> 
> Given an 'index' page that holds a list of all page titles in the
> preferred order, isn't it possible to create a template that selects the
> correct previous and next page title given the current page title?
> 
> I get stuck in getting the correct lines from the index page. DPL can
> select based on section name (= page title), but then the contents of that
> index section must be the prev/next links themselves:
> 
> =First Page=
> Prev [[Second Page|Next]]
> =Second Page=
> [[First Page|Prev]] [[Third Page|Next]] =Third Page=
> .. etc.
> 
> This works, except that it is still a lot of duplication of page names
> (but the edits are contained in a single page, big plus).
> 
> I hoped to simplify the index page by creating a template that writes the
> section header and prev/next links, but then DPL no longer recognizes the
> sections :-( Apparently DPL 'sees' the page text before the templates are
> called ({{Page|Prev page|Page title|Next page}}:
> 
> {{Page||First Page|Second Page}}
> {{Page|First Page|Second Page|Third Page}} {{Page|Second Page|Third
> Page|Fourth Page}}
> 
> Basically my questions are:
> 1. Am I completely off track here?
> 2. Can DPL be coerced to evaluate templates before looking at the page 3.
> Can DPL (or another extension) select the text from a section before/after
> a matched section?
> 4. Is it possible to determine the section sequence number given the
> section name (so 'Second Page' results in 2, allowing me to use DPL to
> retrieve the name of section 2 -/- 1 and 2 + 1 to create the prev/next
> links?
> 
> Apologies for the long post, hopefully someone can point me to some good
> resources (I've been to Meta, Wikibooks, Medawiki.org but could very well
> have overlooked something there as the amount of info is a bit
> overwhelming and it is difficult to judge how up to date it is).





More information about the MediaWiki-l mailing list