PHP code example of craftsnippets / table-of-contents

1. Go to this page and download the library: Download craftsnippets/table-of-contents library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

craftsnippets / table-of-contents example snippets


{% set tableOfContents = craft.toc.getLinks(html, 'h1,h2,h3', null, true) %}