Wikipedia talk:Village pump (proposals)/Sidebar redesign/programming

From Wikipedia, the free encyclopedia

[edit] quick code needed

  • (unresolved) how to use parser_functions for {{#if }}, probably containing an efficient way of handling adjacent and sub-elements. --gatoatigrado 04:30, 30 September 2006 (UTC)

[edit] possible approaches

Here are some options I could think of. --gatoatigrado 02:10, 28 September 2006 (UTC)

  1. html and if statements, cache after static replacements (e.g. main page link)
  2. full parsing, cache a lambda function
  3. keep most of syntax intact, edit MonoBook.php.

[edit] new mediawiki page

To maintain backwards compatibility and sanity, I think that this should use MediaWiki:Sidebar2 or something like that. I have coded this, as it is very simple, and if anyone wants it I can post it. --gatoatigrado 02:10, 28 September 2006 (UTC)

[edit] html and if statements (approach 1)

append this code to Skin.php before the end of the class. Image:Mediawiki html sidebar code.pdf. One last thing to do - make Monobook.php read $this->data['htmlsidebar']. There's also a small modification to SkinTemplate.php to store the htmlsidebar variable if it's not false. --gatoatigrado 17:49, 25 September 2006 (UTC)

[edit] parsing if statements (approach 1, 2)

If anyone has a good way to parse the if statements so they are nested correctly it would help a lot. I think it's done somewhere in the parser functions, but I can't understand their code. I would appreciate knowing how to use it so I don't have to write something that does the same thing, and probably not as well. --gatoatigrado 04:41, 27 September 2006 (UTC)

[edit] the quick hack (approach 3)

code at User:Gatoatigrado/sidebarhack for the first three boxes. I would like Wikipedia's toolbox because it has a modification to add the cite field. Thanks. --gatoatigrado 17:18, 29 September 2006 (UTC)

why the MediaWiki:Monobooksidebar is necessary. it couldn't be cached because the "#sidebar" box will show up as a header for an empty box. If it was quickly removed (because the skin wasn't monobook), the search box might be pushed down too far. If this could be coded more elegantly, it would be nice, but please ask first so it doesn't lose efficiency (or worse, accuracy). I didn't test out every case for the caching if's yet - it's sort of a pain to delete MediaWiki:Monobooksidebar and wait for all of the caches to be updated (usually involves a server restart). --gatoatigrado 04:24, 30 September 2006 (UTC)
the toolbox isn't quite done yet. The line doesn't disappear if there are no elements above or below. --gatoatigrado 15:57, 3 October 2006 (UTC)

Everything should work now. The code for the toolbox is much more concise. --gatoatigrado 20:27, 4 October 2006 (UTC)

[edit] bugzilla report

A request for review has been filed at http://bugzilla.wikimedia.org/show_bug.cgi?id=7493. --gatoatigrado 20:40, 4 October 2006 (UTC)

Looks good and I can't find anything wrong with it. The only thing missing from the proposal is 'cite this page', however, Special:Cite is not an official part of MediaWiki as you said earlier; the likelihood of its inclusion in MediaWiki's phase3 trunk is remote, so I'm not worried about it. Good job. :) --DavidHOzAu 12:27, 5 October 2006 (UTC)