Posted 2007/07/04
Little wiki hack
I am tweaking the CSS for the wiki to remove the Table Of Contents for pages.
I wanted to suppress the TOC on wiki pages because it takes up a huge amount of space. Normally all of the custom layout is done using the template engine, that way when you upgrade DokuWiki you don't have to re-edit any files. Unfortunately fixing the TOC requires a hack to the DokuWiki source code, this change will have to be applied every time we upgrade the software.
/usr/share/dokuwiki/inc/parser/xhtml.php function render_TOC(){ return ‘'; if(count($this->toc) < 3) return ''; global $lang; $out .= '<div class="toc">'.DOKU_LF; $out .= '<div class="tocheader toctoggle" id="toc__header">'; $out .= $lang['toc']; $out .= '</div>'.DOKU_LF; $out .= '<div id="toc__inside">'.DOKU_LF; $out .= html_buildlist($this->toc,'toc',array($this,'_tocitem')); $out .= ‘</div>’.DOKU_LF.'</div>’.DOKU_LF.”; return $out; }
The hack is to just return an empty string from the function that makes the TOC .