Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 11:19:57 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155556 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: New Droplet: CreateToc  (Read 303 times)
BlackBird
AddOn Development
*
Offline Offline

Posts: 2069



WWW
« on: November 15, 2011, 05:23:41 PM »

The CreateToc-Droplet creates a "Table of Contents" from all headings (h1-h6) in a page. The Toc is placed where you place the droplet call. In addition, a "Back to Top"-Link is added before each heading.

Download:

http://www.websitebakers.com/pages/droplets/downloads.php (scroll to "Navigation")

Usage:

[[CreateToc]]

or

[[CreateToc?float=right]]

...to have the Toc floated right. If you wish to have your entries numbered (like an index), add

[[CreateToc?float=right&number=1]]

(The value you give for "number" doesn't matter. You can also set it to "true" or "ohmy" or ...)

ToDo:

* At the moment, there's no indentation; i.e., in the Toc there's no difference between h1 and h6


Best use:

If you have just one WYSIWYG-Section on a page, you may create your own Toc by adding Anchors. But if you have more than one WYS-Section (or sections of other types), CreateToc creates a nice Toc for you. Smiley

Try it and let me know how it works.
« Last Edit: November 16, 2011, 01:20:41 PM by BlackBird » Logged

Alle großen Veränderungen beginnen im Kleinen
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #1 on: November 15, 2011, 09:09:40 PM »

Good idea.

One just must be carefull by not using headings in the template itself (i.e. sidebars etc.).

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #2 on: November 16, 2011, 09:43:54 AM »

Good idea.

One just must be carefull by not using headings in the template itself (i.e. sidebars etc.).

Regards,
Stefek

For this you could use a special Format within the CKEEditor to use a Class with the H1 - H3 and search with the Droplet for this CSS class....no problem....but this must be arranged by an admin or will be a good tut....Wink

great idea bianka! - i will use it

regards mr-fan
Logged

 
BlackBird
AddOn Development
*
Offline Offline

Posts: 2069



WWW
« Reply #3 on: November 16, 2011, 10:33:04 AM »

Well, I'm sure it's easy enough to tweak the droplet for one's need. (Use something else than headings, for example.) Also, one could replace headings in the template with <span> and some CSS (this is what I would do).

I've got a new version now that numbers the extracted headings and indents them, too. This is not done by using <ol>, because this would require to use recursion. I think this would be overkill for a droplet. I will upload the new version later.
Logged

Alle großen Veränderungen beginnen im Kleinen
BlackBird
AddOn Development
*
Offline Offline

Posts: 2069



WWW
« Reply #4 on: November 16, 2011, 01:18:55 PM »

I've updated the Droplet. Download at http://www.websitebakers.com/pages/droplets/downloads.php

Preview: http://lepton.webbird.de/page/droplets/createtoc.php
Logged

Alle großen Veränderungen beginnen im Kleinen
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!