[Mediawiki-l] Page templates?

David J. Biesack David.Biesack at sas.com
Fri May 13 15:19:27 UTC 2005


I'm still learning how to use MediaWiki, and I can't figure out if what I want is possible or not. If not, I'll submit a MediaZilla feature request.

I want to define page layout templates - not the current Templates that are more like macros, but rather
a common page layout that I can associate with pages, for example with a new namespace "Layout:",

  [[Layout:MyLayoutName]]

or perhaps indirectly by associating a layout with a category, or as a choice in the page editor.

For example, I may want to automatically include a header, navigation, and footer template on a subset of pages, for example, for pages about Eclipse. I may define a layout as follows

   {{Eclipse-heading}}
   {{Page:content}}
   {{Eclipse-navigation}}
   {{Eclipse-footer}}

However, I don't want to have to include these templates in each and every page in the Eclipse category.
Rather, I would like to create a [[Layout:Eclipse]] page layout and by referencing [[Layout:Eclipse]] on these pages, it will use that page layout; i.e. automatically include the heading, navigation, and footer. Such layouts may contain <div> or <table> or other layout markup, whether (restricted) html or wiki.

When a page is previewed or saved, its body is substituted where {{Page:content}} (or some other meaningful marker/variable) appears, and the other templates/markup inserted as if they were on the original page. User's editing such pages would not have to explicitly include this boilerplate, and I could change this page layout template once and all pages which use it would render with the new layout.

Only one page layout is needed per page, although I can see how it may be possible/desirable to nest them via a Decorator pattern; the output of applying one page template then becomes the {{Page:content}} for the next. This would be tricky; you would not want to reformat/reinterpret the text as markup. In addition, some layouts may themselves reference other layouts. (beware of cycles, though!)

Finally, I would expect to have a default page layout for the site; i.e. [[Layout:default]] or [[Layout:site]]. For example, there is an implicit page layout template already which includes MediaWiki:Sitenotice and MediaWiki:Tagline. I would like to make it more explicit and customizable and allow different pages or categories to have their own custom page layouts (either replacing or augmenting other layouts).

Is there some feature of MediaWiki which provides something like this (or an existing 

-- 
David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive
http://www.sas.com   Cary, NC 27513




More information about the MediaWiki-l mailing list