How do I add a global template in all MediaWiki pages?
I want to add a piece of wiki markup to all MediaWiki pag开发者_高级运维es (exiting and future ones).
This piece of wiki markup code doesn't have to be part of the page body because I do not want people to modify it.
How can I obtain this?
Details: I am using the FB-Connect extension to enable Facebook authentication and comments but it looks that, in order to enable comments for all pages I have to append <fb:comments></fb:comments>
to each page. I do not want to end-up editing each wiki page.
I know I'm late, but just in case you haven't figured this out yet, there's a useful feature on Mediawiki (Sitenotice) that lets you display defined text at the top of all wiki pages. This should help with your situation.
I put my facebook like buttons into skins/Vector.php. Search for footer. I describe it here: http://www.linuxintro.org/wiki/Mediawiki#FaceBook_like_buttons
You could write a small MediaWiki extension that uses a hook to execute a function that modifies the page output after the article content has already been parsed and insert the comment area where you want.
Based on line 72 here, it looks like all FB-Connect does when you put <fb:comments></fb:comments>
in the article text is cause the same thing to be outputted in the HTML, and everything else is probably handled by javascript(s) that FB-Connect includes by default. So, you can simply use the SkinAfterContent hook if you want the comment box to appear below the content box (a good example of this is Semantic MediaWiki's Factbox - example) . If you want the comment box to appear within the article content or especially at a specific place within the article content, then you need one of the page rendering hooks, possibly ParserAfterTidy, though I'm not sure.
If you need the hooked function to output a template, or other mediawiki markup, then it's possible to more or less pass some markup and the Page object to a Parser and get the resulting html text.
精彩评论