Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
get the toc hidden
Avatar
apuschmann #1
User title: arno
Member since Aug 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: get the toc hidden
I think the table of content (toc) is very needless, so where can i configure that the default value is set to the option that the toc ist hidden.
Don't understand me wrong, i don't want that the toc disappear completly like i can add the lines ~~NOTOC~~, i just want that the default value is set at the state as when i click on the little arrow next to the text "table of content",so that the with the headlines in the wiki is hidden.
So that i can add my toc when i really need it and others i don't waste the space on my page.

I tried to fix something in the code in the script.js like this

toc.style.display = 'none'

but it don't work.

The only think i can imaging where i can change something is on the mywiki/lib/scripts/script.js beginnig on line 244

function addTocToggle() {
    if(!document.getElementById) return;
    var header = $('toc__header');
    if(!header) return;

    var obj          = document.createElement('span');
    obj.id           = 'toc__toggle';
    obj.innerHTML    = '<span>&minus;</span>';
    obj.className    = 'toc_open';
    obj.style.cursor = 'pointer';


    prependChild(header,obj);
    obj.parentNode.onclick = toggleToc;
    try {
       obj.parentNode.style.cursor = 'pointer';
       obj.parentNode.style.cursor = 'hand';
    }catch(e){}

}

/**
 * This toggles the visibility of the Table of Contents
 */

function toggleToc() {
  var toc = $('toc__inside');
  var obj = $('toc__toggle');
  if(toc.style.display == 'none') {
    toc.style.display   = '';
    obj.innerHTML       = '<span>&minus;</span>';
    obj.className       = 'toc_close';
  } else {
    toc.style.display   = 'none';
    obj.innerHTML       = '<span>+</span>';
    obj.className       = 'toc_open';
  }
}

but i don't know what and where
Avatar
alice|wl #2
Member since Oct 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
in the tpl main.php you can do
<?php tpl_content( false )?>

http://dev.splitbrain.org/reference/dokuwiki/nav…?_funct…
Avatar
mwolf #3
Member since Nov 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
in the dokuwiki/inc/parser/xhtml.php add style="display: none;" in line 108 like this:
$out .= '<div id="toc__inside" style="display: none;">'.DOKU_LF;
Avatar
jedson #4
Member since Jul 2006 · 19 posts · Location: Virginia
Group memberships: Members
Show profile · Link to this post
Subject: Did you get it to work
apushmann --

Did you ever get that to work? If so how? I was going to post the same question. I tried the suggestions given, but could not get the desired results. I am not the most expert person in the world with php script, but I think I followed the instructions correctly.  I want the button to still be there, but the default to be that the toc is not shown.

jedson
Avatar
ach (Moderator) #5
Member since May 2006 · 544 posts
Group memberships: Global Moderators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
In reply to post #3
Quote by mwolf on 2008-11-05, 17:05:
in the dokuwiki/inc/parser/xhtml.php add style="display: none;" in line 108 like this:
$out .= '<div id="toc__inside" style="display: none;">'.DOKU_LF;
This works for me if I do that in ./inc/html.php!

Another way could be to exchange the following lines in function addTocToggle() in ./lib/scripts/script.js
  1.     obj.innerHTML    = '<span>&minus;</span>';
  2.     obj.className    = 'toc_close';
with these lines instead
  1.     obj.innerHTML    = '<span>+</span>';
  2.     obj.className    = 'toc_open';
  3.     $('toc__inside').style.display   = 'none';

Please be aware that changing the core code will make upgrades more difficult.
Avatar
drodrig0 #6
Member since Jun 2009 · 9 posts
Group memberships: Members
Show profile · Link to this post
I tried with this procedure but didn´t work. Actually come back to the original configuration and the TOC is always open and is imposible close it.
Please  anyone could help me?
Avatar
ach (Moderator) #7
Member since May 2006 · 544 posts
Group memberships: Global Moderators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by drodrig0 on 2009-07-01, 22:34:
I tried with this procedure but didn´t work. Actually come back to the original configuration and the TOC is always open and is imposible close it.

Both methods still work for me. Did you clear your browser cache?
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please note the verification code from the picture into the text field next to it.
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20090606-dev, © 2003-8 by Yves Goergen
Current time: 2010-03-21, 21:05:07 (UTC +01:00)
WikiForumIRCBugsGitXRefTranslate