Skip to content

New AdManager extension

The folks at the American Academy of Ophthalmology asked us to create an AdManager that could be managed in full from the wiki itself. They were using BanManPro which allows you to create zones, with each zone corresponding to a particular ad. AAO wanted per-page or per-category control of which zone was assigned to which page. We created the AdManager extension but we designed it so it could be used with OpenX or really any ad service. The extension currently sticks the ads in the sidebar. You can place any number of zones there. See it in action here.

I think the way we hooked into the sidebar was neat and the tips I took from it are useful for any other extension that adds to the sidebar. We of course used the SkinBuildSidebar hook. The problem is that monobook automatically puts a header on top of the new sidebar item – in this case AdManager1 – and puts a border around it. Neither of these was desired. Good thing that MediaWiki also gives it an id (p-AdManager1) so you can use some CSS to hide it. The trick here is that there can be multiple zones added so we may have other ids like p-AdManager2 and so on. So here’s the nifty CSS that will match all of those ids:

div[id*='AdManager'] h5 {
	display: none; #Hide the header
div[id*='AdManager'] .pBody {
	border: none; #and the border
	padding-left: 0; #override the normal padding

Unfortunately, you’ll need admin rights to see the 2 special pages that handle the settings. And that’s that.

Categories: Uncategorized.

Tags: ,

Comment Feed

No Responses (yet)

Some HTML is OK

or, reply to this post via trackback.