[dokuwiki] Re: Where is the "html_toc" function?

Rex Gozar wrote:
Browsing thru the site, I saw a reference to html_toc(), that was alledgedly
in inc/html.php.  I had downloaded the latest release and it is not there.

I am attempting to use the 'sidebar' patch, and I want to display the TOC in
my sidebar instead of the page body.  So I need two things, (1) how do I
turn off the TOC in the page, and (2) what function do I call to get the
HTML for the TOC?

rex

The TOC is generated by the parser after it processes the page, the TOC is then prepended to the parser output and returned to the function which called the parser - somewhere below tpl_content() (I could have the wrong name, its the function in your templates main.php which is called to get the wiki page content). There is currently no way to independently access the TOC - at least not, without post processing the data returned by tpl_content.

You may well be able to style your wiki template so that the TOC is not floated to the right of .page but is positioned absolutely in a column space left empty to the left of the main page. Something like:

.page {
 position: relative;
 margin-left: 150px;
}

.toc {
 position: absolute;
 width: 145px;
 left: -150px;
 top: 0;
}

You'll need to check for precise class names, and I have only mentioned styles important for achieving the mentioned layout. You'll need to workout which of the existing styles need to be preserved or changed.

Given the toc is formed from headings in the page, it shouldn't be possible for the TOC to be taller than the page itself, which means there should always be sufficient space for it.

I hope this helps.

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: