GithubHelp home page GithubHelp logo

dr2005alex / cot-toc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trustmaster/cot-toc

0.0 2.0 0.0 105 KB

Table of Contents plugin for Cotonti

Home Page: http://www.cotonti.com/extensions/navigation-structure/table-of-contents

PHP 100.00%

cot-toc's Introduction

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. Both the documentation index page and sidebar on the right on regular pages like this 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:

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.