By Stephen Winters on
Does Drupal have some way to put a "Page Contents" menu on a Drupal web pages, such as one shown on the upper right on this page: Wakka.xiffy.nl?
Thanks,
Stephen
WintersSewing.com
Does Drupal have some way to put a "Page Contents" menu on a Drupal web pages, such as one shown on the upper right on this page: Wakka.xiffy.nl?
Thanks,
Stephen
WintersSewing.com
Comments
yep..
there's a number of ways of doing it...I quite liked the related links.module, but that doesn't seem to be there anymore...there are others that do it automatically in the drupal module download pages.
check out the taxonomy modules and maybe the context.module
hope that helps
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Page Content menus from Headings on Page.
Hi Dub,
ExampleThanks for responding. I don't think that I was very clear about what I mean. What I'd like to do is to put headings above each paragraph or section a page (see example below) And then those headings would feed into the "Page Contents" box (as shown in the link in my first message above. You just click on one of the listings in the "Page Contents" box and you are immediately taken to the corresponding paragraph below. So, to restate that, the entries in the Page contents box would take you to a lower position on the same page. The Page contents would also be kind of like an outline of what's on the page. Would the method you stated above work, meaning the entries would link to a page heading instead of another web page? Is there an easy way for site editors to create the "page contents" box, or could it be automatically created?
Heading one
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
Heading Two
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
Heading Three
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
Thanks,
Stephen
Winters Sewing
Also looking for this
I'm also looking for this as a article-index/contents-index for long articles.
Another example from Wikipedia.
maybe this will help
HI Stephen,
I understand what you mean now..I was looking for some tips on how to paginate long articles in drupal and sumbled across this piece of code that generates a TOC from H1, h2, or h3 headers.
Thought I'd post it in case it sparks any ideas.
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Page Content menus from Headings on Page.
Hi Dublin
As another example of creating a "Page Contents" menu from the H1, H2, H3, etc, I put together some info about how to make a "Page Contents" menu in TikiWiki, here:
http://www.carrscorner.com/tiki/tiki-index.php?page_ref_id=208. I had gotten this info from the TikiWiki.org website. I was hoping there might be a simpler, or just a way, to create something similar in Drupal.
Stephen
this is a good one!
yeah. this is a good solution. no implementation effort in php. just include the javascript code in your page templates.
http://www.quirksmode.org/dom/toc.html#link7
UPDDATE: argh! while it works perfectly in a stand alone way, i cannot make it working inside drupal (tried both php and full html input formats).
Beware, in-page links/anchors are broken in Drupal
Due to the way every page is served with the HTML BASE set to be the Drupal-root, trying to link to other sections within the same page using href='#section' does not work.
This can only be called a bug.
I'm sure it's been commented on before, and it should be quite easy to fix with a custom output filter.
A quick search on 'anchor link' gave me this discussion
In other news, many folk suggest using full URLs to solve this (serious) problem - which seems to be short-sighted, obtuse, and downright ill-advised. Definately a trap for young players this one...
.dan.
.dan. is the New Zealand Drupal Developer working on Government Web Standards
got it figured out, just need help making module/filter
Hey guys, so I found some code at http://jehiah.com/archive/the-holy-grail-of-toc-scripts
and made a slight modification so it worked with the anchor problem in Drupal.
Where I need help is automatically inserting the attached code below the:
And then adding a closing div tag right before the the end of the content.
I assume this could be done with a module/filter but have no knowledge in this area. Right now the code works if you paste it as Full HTML.
The code can be downloaded from my server at www.nik.ca/online/files/drupal_auto_toc_script.txt
Hope this helps
Anyone made this work in final form?
This is quite an old thread, but I am hoping that someone out there who has had the same need for this functionality will see this bump and have something helpful to contribute.
The script (http://jehiah.cz/archive/the-holy-grail-of-toc-scripts) looks like it would work great for my needs, though it would be nice if it picked up on H2 and H3 headers and indented them accordingly. My problem is that I am a butterfingers with javascript and I am not sure how to integrate this properly with Drupal (and nikle's code is gone), so I am hoping someone else has or can do so easily.
Anyway, if anyone can point me in the direction of node TOC generation based on header tags code that is already for Drupal, or help out with the code provided here, that would be great.
Maybe it would find it's
Maybe it would find it's best home at http://drupal.org/project/tableofcontents ?
http://socialsynergyweb.net/cgi-bin/wiki/HomePage