Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content table impractical in layout - belongs in the sidebar #2

Open
websocketdev opened this issue Dec 20, 2010 · 3 comments
Open

Comments

@websocketdev
Copy link

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.

@ghost
Copy link

ghost commented Mar 3, 2011

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

samwilson added a commit that referenced this issue Oct 8, 2011
@samwilson
Copy link
Owner

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).

@ghost
Copy link

ghost commented Oct 9, 2011

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants