GithubHelp home page GithubHelp logo

tardinha / silverstripe-autotoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ntd/silverstripe-autotoc

0.0 2.0 0.0 118 KB

Dynamically generates the table of contents

Home Page: http://silverstripe.entidi.com/

License: BSD 2-Clause "Simplified" License

PHP 97.36% Scheme 2.64%

silverstripe-autotoc's Introduction

silverstripe-autotoc

Generate the table of contents dynamically from $Content.

This is basically a SilverStripe 3 module that extends the ContentController class to provide:

  • the new $Autotoc tag, containing the table of contents dynamically created from the content of the current page. The tree is provided as a mixture of ArrayData and ArrayList, ready to be consumed by templates.
  • overriding of the standard $Content tag, augmenting it with anchors (<a> elements with the id attribute but without href) that adds proper destination targets to the links in $Autotoc.

Autotoc format

The $Autotoc is a tree that can be represented with the following pseudo representation:

$Autotoc = ArrayData( $Children <- <CHILDREN> )
<CHILDREN> = ArrayList( <ITEM> )
<ITEM> = ArrayData( $Id, $Title [, $Children <- <CHILDREN> ] )

In a more SilverStripe template way, this can be seen as:

$Autotoc
    $Children[]
        $Id
        $Title
        $Children[]

The Autotoc.ss and AutotocItem.ss shows a way to represent the whole table of content tree in a recursive way. The format used is intentionally compatible with the Bootstrap navlist components, so it can be used and it will be properly handled by the Silverstrap theme.

Support

For bug report or feature requests, go to the dedicated development tracker.

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.