Dynamic header image

Fragment of a discussion from Project:Support desk
Jump to: navigation, search

You can use css perhaps.

For example on vector (in mediawiki:Vector.css)

body.ns-1 #mw-head {background-image: url( http://somewhere/someimage.png );}

Would change the background at the very top of the page to someimage.png for any talk page (talk is namespace 1. All namespaces have there own number. The main (article) namespace is namespace 0).

You can also do per-page changes:

body.page-Extension_Logotipo #mw-head {background-image: url( http://somewhere/someimage.png ); }

would change it on extension:Logotipo only.


If you want to do something in a template, you'd probably need to create a custom extension.

Bawolff08:29, 29 December 2011

Thanks. Although I'm not using separate namespaces myself, your first suggestion does look like it could be a workable solution for many users. As for myself, a custom extension would certainly be the way to go. Extension:Logotipo looks childishly simple, but I don’t have any experience with writing code. There at least three extensions which claim to provide custom headers on a per-page basis but just what is meant by 'headers' in those cases is not clear to me and none appears to be fully functional:

Cavila MW 1.17, MySQL 5.5.16, Php 5.3.815:16, 29 December 2011

Cavila, My extension HeadersFooters inserts a header/footer into the text of an article before it is parsed. The idea is that you can also insert wikitext and most importantly things like the references tag for cite and it will work. Unfortunately MW is not made to insert text only for the display (and not for edit) at that point, so things are very buggy as I find new cases when editing or saving the text adds the header/footer into the actual article. Once I work them all out, I'll consider it in the beta stage. An extension that doesn't depend on the content of the article would be much simpler, and could be done post-article processing. I'm not sure if the old HeaderFooter extension did this or not, it's certainly more error proof but means that your header/footer has to be free standing (you can't use a cite tag, there are no known citations to list!) I don't see progress being made quickly on my extension but I'm committed to continuing the work as I learn more about MW.

Olivier Beaton15:41, 29 December 2011

Oh, I see, thanks for the explanation.

If you happen to know of a working example, it would be worthwhile adding one to the documentation, but maybe it's too early for that now.

Cavila MW 1.17, MySQL 5.5.16, Php 5.3.814:14, 2 January 2012
 
 
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox