Extension talk:CustomSidebar

Comments & bug reports welcome :) --Frantik 08:46, 28 May 2009 (UTC)

not transcluded from templates
I'm trying to add a custom sidebar through a template. I've put a custom sidebar (using the tag) in a template. However, when I include the template in a page, the custom sidebar doesn't show on that page; instead the sidebar shows up on the template page. This happens even though the tags appear between tags.

Any ideas for a fix or workaround? I'm no Wiki expert, but I'm guessing it has something to do with searching for tag in wgArticle->getContent without parsing it first? ~KH


 * Fixed my own problem! Preprocessing the article text solves this issue. I've managed this by initiating a parser (+ parseroptions) and replacing $pagetext = $wgArticle->getContent; with $pagetext = $wgParser->preprocess( $wgArticle->getContent, $wgArticle->getTitle, $opt ); Please add this fix or a similar solution in the next revision of this extension. ~KH
 * Cool thanks :) I've been meaning to release a newly updated version with many new features; I will include your changes as well. --Frantik 09:44, 7 August 2009 (UTC)
 * I was able to use your suggestion to enable full template support, so thanks :) version 0.3.0 is available for download now --Frantik 22:34, 9 August 2009 (UTC)

Adding a second bar?
Thank you for the good extension. I wonder if it would be possible to add another function to call within the skin php file, as we do with the buildsidebar built in function? I mean a "build_top_bar" function that works as your extended sidebar. Can you implement this? Generating a second bar different to manage via your extension would be really nice for me (though it has to be customized in the skin).--Federicodip 20:14, 8 August 2009 (UTC)
 * I'm not quite sure I understand what you mean --Frantik 10:58, 9 August 2009 (UTC)
 * It was late night and I realize now what I wrote was cryptic. I'll try to explain my project:
 * I wanted to create a second bar (topbar) that I wanted to manage like the default sidebar, editing a page wihin mediawiki (mediawiki:sidebar). This was the beginning. When I saw your extension I realized that the bar could have some dynamical content. And in the example:  $wgDefaultSideBarText = ':/Sidebar'  - I saw it could be possible to customize bars content for different namespaces.
 * In your extension you use a hook to change the default buildSidebar function. I don't know much about building an extension, but I thought about changing a bit of your code, using part of your extension (mostly the function fnSidebarHook) without the hook, not to change buildSidebar, but to provide a new function buildTopbar that I could call wihin my skin file. So I could use and manage a second navigation bar, dynamically based on namespaces.
 * I also thought about changing the code so that I could manage namespaces bar content using only a single page mediawiki:top(ns)bar in witch rows with a * at the beginning define namespaces, and rows with two ** at the beginning are links of that namespace, but as a php noob its not so easy for me. Anyway a $wgDefaultTopBarText would work good and I could customize many foo/(top)bar. Can you help me? Can I try to change your extension and to build a new one using your code?--Federicodip 12:05, 9 August 2009 (UTC)
 * I'm not sure if you can use my extension because Mediawiki generates the HTML for the sidebar after the hook is run.. so you can't just include the function in the skin --Frantik 21:16, 9 August 2009 (UTC)
 * I've seen you added "... an additional sidebar" in your 3.0 release. :D
 * Can you explain a bit more how it works? I mean, does it add data to sidebar or provides a brand new one? And how must I call that bar in my skin? Something like that works?:
 * data['new_bar'] as $bar => $cont) { ?>
 * You do not add anything to your skin. The extra sidebars still appear in the sidebar region of your skin.  The extra features just allow you to customize sidebars based on namespace and usergroup.  instead of replacing the other sidebar text, it appends it.  My extension does not access the skin layer at all, it just processes text and converts it into the format that mediawiki expects for sidebars.  --Frantik 14:00, 10 August 2009 (UTC)