Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trustmaster/cot-toc
Table of Contents plugin for Cotonti
https://github.com/trustmaster/cot-toc
Last synced: about 1 month ago
JSON representation
Table of Contents plugin for Cotonti
- Host: GitHub
- URL: https://github.com/trustmaster/cot-toc
- Owner: trustmaster
- Created: 2012-06-27T11:52:42.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-08-14T10:07:11.000Z (over 7 years ago)
- Last Synced: 2024-10-15T21:29:44.353Z (3 months ago)
- Language: PHP
- Homepage: http://www.cotonti.com/extensions/navigation-structure/table-of-contents
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Table of Contents plugin for Cotonti
Renders contents tree for a given category.
## Installation
1. Download.
2. Copy 'toc' to your plugins folder.
3. Install via Administration / Extensions.## Demo
To see the plugin in action visit [Cotonti Documentation](http://www.cotonti.com/docs/). Both the documentation index page and sidebar on the right on regular pages like [this](http://www.cotonti.com/docs/ext/extensions/extdevguide) are generated with this plugin.
## Usage
The plugin provides a callback/widget that can be used in page.list.tpl and page.tpl files (including category-specific files).
The following will print entire table of contents for category with code 'docs':
```
{PHP|toc('docs')}
```By default 'toc.tpl' is used to generate a TOC, but you can use custom TPL files for different widgets. The following will generate a TOC using toc.main.tpl:
```
{PHP|toc('docs', 'toc.main')}
```In subcategories and on regular pages you wouldn't like to include the full tree. You can tell the widget to show pages for current category only:
```
{PHP|toc('docs', 'toc', 1)}
```This will leave all the non-current categories collapsed.
Use CSS to style the TOC. Here is an example:
```css
ul.toc {
list-style: none;
margin: 10px 10px 10px 20px;
display: block;
clear: both;
}ul.toc a.current {
background-color: lightYellow;
}ul.toc-main {
list-style: none;
margin: 10px 10px 10px 40px;
display: block;
clear: both;
}ul.toc-main a.level-1.cat {
font-size: 180%;
}ul.toc-main a.level-2.cat {
font-size: 150%;
}ul.toc-main a.level-3.cat {
font-size: 120%;
}
```For more information see 'toc.php' source and PHPDoc blocks in it.