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
I don't think you can do this automatically, but it is possible to do something like you're describing (I think).
On 5/13/05, David J. Biesack David.Biesack@sas.com wrote:
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.
Create a custom namespace. In LocalSettings.php, add these lines: $wgExtraNamespaces[100] = 'Layout'; $wgNamespacesToBeSearchedDefault[100] = 0; $wgNamespacesWithSubpages[100] = 0; $wgExtraNamespaces[101] = 'Layout_talk'; $wgNamespacesToBeSearchedDefault[101] = 0; $wgNamespacesWithSubpages[101] = 0;
This creates the namespaces Layout and its talk pages Layout_talk, which are not searched and do not contain subpages.
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.
No, I don't think you can do it as described (automactically). You can, however, have 2 templates: {{Eclipse/top}} and {{Eclipse/bottom}} (yes, I know Template doesn't have subpages). Then on every Eclipse page, have those at the top and bottom. To do this initially, have {{subst:Layout:Eclipse}}, which inserts everything.
You can also use the templates like this: {{Layout:Eclipse| Body text here }} and substitute {{{1}}} for {{Page:Content}}. This would be more automactic, but I'm not sure how well the WikiEngine would handle it. (Templates were designed for small, little things.)
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
-- Jamie ------------------------------------------------------------------- http://endeavour.zapto.org/astro73/ Thank you to JosephM for inviting me to Gmail! Have lots of invites. Gmail now has 2GB.
mediawiki-l@lists.wikimedia.org