mediawiki_twentyten icon indicating copy to clipboard operation
mediawiki_twentyten copied to clipboard

Content table impractical in layout - belongs in the sidebar

Open websocketdev opened this issue 14 years ago • 3 comments

Because of the layout attributes (font size, column size), the table of contents (toc) inserted by Wikimedia pretty much takes up so much real estate that it is impractical to have a toc, forcing the usage of notoc in all the pages.

I tried to edit the template by adding a way to move the toc to the sidebar, which is really where it belongs in this layout. The code I tried was the following, but it was not successful, because it looks like Wikimedia actually caches the toc.

In the class SkinTwentyTen, I added a method to override tocList found in Linker.php. The idea is to have this function return nothing, but transfer the contents to savedTOC and use a "print $this->skin->savedTOC" to display the contents in the sidebar.

 function tocList($toc) { 
    $this->savedTOC = parent::tocList($toc); 
    return ""; 
} 

However, turns out this function is only called when the content of a page is updated, but not during a simple page view. It gets cached the rest of the time, and I don't know what the function is that Wikimedia uses for the cache.

I will continue to try to work around this and come up with some code that consistently stores the toc inside the template so I can put it in the sidebar, but if you happen to have a simple way to get it into the sidebar, that would be a great improvement to this skin.

websocketdev avatar Dec 20 '10 16:12 websocketdev

Would just like to mention that I'd really like to see this as well, and since I'm new to this site and don't yet know how to be notified of changes, would love to hear if the status on this is changed/fixed

ghost avatar Mar 03 '11 00:03 ghost

And nearly a year later, I've done something about this! :-) Sorry it's taken me so long. Download the new version, and let me know what you think.

@worldsight's idea was correct: overriding tocList() was the way to do it (as Walter Mazza also mentioned in 2009). The way I got around the caching problem was to save the ToC HTML to the cache, by itself, and then retrieve it when needed (in TwentyTenTemplate::pageTocBox()). I'm not completely convinced that this is the most elegant way of doing it, so let me know if I've overlooked anything!

For completeness, I'll just note here that there is also mozilla.org bug 551200 which is trying to solve this same problem (with a different skin).

samwilson avatar Oct 08 '11 02:10 samwilson

Great, seems like my cache isn't refreshed until a page is edited, but apart from that it seems to work nice from what I've had time to test. Thanks a lot!

ghost avatar Oct 09 '11 08:10 ghost