Last modified: 2011-04-14 15:10:37 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T4187, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 2187 - Feature request: page layout templates
Feature request: page layout templates
Status: NEW
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-16 13:15 UTC by David Biesack
Modified: 2011-04-14 15:10 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description David Biesack 2005-05-16 13:15:05 UTC
I want to define page layout templates - not the current Templates that are more
like macros, but rathera 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 articles about Eclipse. I
may define a layout, called [[Layout:Eclipse]], 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 (similar to how one references
categories), 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.
(I'm suggesting one implementation; other implementations for assiging a page
layout to
a page are also possible.)

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).
Comment 1 David Mestel 2008-05-29 09:16:26 UTC
I may be being dense, but couldn't your example be just as easily implemented with a Template:Eclipse, consisting of
{{Eclipse-heading}}
{{{content}}}
{{Eclipse-navigation}}
{{Eclipse-footer}}

To then be called with {{(subst:)Eclipse|content=An eclipse is a rare event...}}?
Comment 2 David Biesack 2008-05-29 15:00:22 UTC
My proposal would all changing the template after it has been instantiated,
and all articles using the template would automatically update.
Using subst "erases" the link to the template. Also, full
page content is often too large/awkward to fit into a template call.
Comment 3 David Mestel 2008-05-29 17:47:23 UTC
In that case you could not subst the template.  It's not particularly awkward - all you have to do is have a first line with "{{Eclipse|content=", and a final line with "}}".
Comment 4 David Biesack 2008-05-29 19:24:08 UTC
That does not work if the content contains other template invocations or tables.

For example, see

http://www.mediawiki.org/wiki/User:DavidBiesack/template

which I use in

http://www.mediawiki.org/wiki/User:DavidBiesack/test

Note how the table is lost
Comment 5 David Mestel 2008-05-30 08:19:38 UTC
I stand corrected.  That seems a bit rubbish: time to dive into the parser and make tables work properly :-)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links