Postponed (maintainer needs more info)
Project:
Table of Contents
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
24 Jan 2008 at 22:29 UTC
Updated:
26 Feb 2019 at 20:59 UTC
Comments
Comment #1
deviantintegral commentedThis would require significant work as right now everything is run through an input filter. I think the best way to do this would be to write a hook_block function which would lookup the current node and then call the hook_filter functions itself.
Submit a patch and I'll be glad to commit it.
--Andrew
Comment #2
silurius commentedSubscribing, even though I'm on drupal 6.3. Combined with something like CCK Blocks, this would be a great option to have.
Comment #3
it-was-a-shihtzu commentedI've done this by using the list-building code in a custom block, so it generates the toc from the current node on the fly (no 'tableofcontents' tags even used). It does mean loading every node twice, as the block needs its own copy to do the business.
In this case I have hard coded the options and removed the toc heading (using the block one instead), but you get the drift.
Comment #4
ged3000 commentedNot a fix for this module, but another option would be to use the javascript at http://www.quirksmode.org/dom/toc.html to create and populate a table of contents on the fly. (Demo included on that page)
Comment #5
nicholas.alipaz commentedany further development on allowing toc's in a block? I would like to see it in d6
Comment #6
nicholas.alipaz commentedin d6, in a custom php block I have tried adding this:
Perhaps I missing something, but I can't seem to get the filters to run properly and output the toc. Any help?
Comment #7
nicholas.alipaz commentedok, Looks like I finally got it...
You need to be sure the Headings to Anchors filter still gets ran on the body of the node you are viewing. Then this code goes in a custom php block. It loads up the node and runs the headinganchors and tableofcontents filters on the node then grabs the produced table of contents and displays it in your block.
Comment #8
velden commented@nicholas.alipaz -
That would be so nice if you can use the TOC in a block!
Unfortunately your code echo's an exact copy of my page itself, instead of just the TOC.
Maybe, i just did something wrong? Any suggestions?
Comment #9
nicholas.alipaz commentedIt will only work if your page has a div surrounding your content area like
<div class="inner-content">...yourcontent...</div>, if not then find out what the class is for the div and substitute it for the one my code is searching for. Different themes may have different source.Comment #10
hepabolu commentedI couldn't get #7 to work with version 3 of the module, so I modified #3 (*) and got it working. This requires a [toc hidden:1] in the text.
(*) Changes:
- starting ' added to $pattern
- changed class of ToC list to 'tockblock' to allow separate styling
Comment #11
AlexisWilke commentedhepabolu,
Are you working with version 6.x? because this is a bug for v5.x ... and [toc hidden:1] would not work in 5.x anyway!
Thank you.
Alexis
Comment #12
AlexisWilke commentedIn version 6.x, there is now a block module coming with the Table of Contents plug in.
Version 5 still does not have that feature.
Thank you.
Alexis Wilke