Renders contents tree for a given category.
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.
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.
Поблагодарили: 7 раз
too complicated for me
looks like something i'm looking for
Поблагодарили: 5 раз
Подскажите этот плагин по умолчанию работает по ссылке https://www.наименование.ru/docs/ ? Поставил на последнюю версию он у меня почему то не работает..
Поблагодарили: 181 раз
Он работает там где вызван из шаблона, пример: `{PHP|toc('docs', 'toc.main')}`
А `docs` это просто альяс (код) категории. А чтобы можно было заходить в категории по соотв. ссылки — надо включить ЧПУ, посредством плагина urleditor и установить пресет «удобный».