PHP code example of sylvainjule / footnotes

1. Go to this page and download the library: Download sylvainjule/footnotes 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/ */

    

sylvainjule / footnotes example snippets


// somewhere in your template
echo $page->text1()->collectFootnotes();

// somewhere else in your template
echo $page->text2()->collectFootnotes();

// at the end of your template,
// echo the footnotes container with all collected footnotes
echo Footnotes::footnotes();

// collect the footnotes and return the html with footnotes references
echo $page->blocks->toBlocks()->collectFootnotes();

// at the end of your template,
// echo the footnotes container with all collected footnotes
echo Footnotes::footnotes();

'sylvainjule.footnotes.wrapper'  => 'div'

'sylvainjule.footnotes.back'  => '&#8617;'

'sylvainjule.footnotes.back.title'  => 'Back to content', // -> 'Back to content 1', 'Back to content 2', etc.
'sylvainjule.footnotes.back.title'  => 'Custom title',    // -> 'Custom title 1', 'Custom title 2', etc.

'sylvainjule.footnotes.links'  => false

'sylvainjule.footnotes.snippet.container' => 'footnotes_container',
'sylvainjule.footnotes.snippet.entry'     => 'footnotes_entry',
'sylvainjule.footnotes.snippet.reference' => 'footnotes_reference'

↓

'sylvainjule.footnotes.snippet.container' => 'custom/path/to/footnotes_container',
'sylvainjule.footnotes.snippet.entry'     => 'custom/path/to/footnotes_entry',
'sylvainjule.footnotes.snippet.reference' => 'custom/path/to/footnotes_reference'

// returns the text with footnotes references and a bottom footnote container
echo $page->text()->footnotes();

// returns the text without footnotes references nor bottom footnotes container
echo $page->text()->removeFootnotes();

// returns the text with footnotes references but no bottom footnotes container
echo $page->text()->withoutFootnotes();

// returns only the footnotes container
echo $page->text()->onlyFootnotes();

// returns the text with footnotes references, no footnotes container, but stores the footnotes container for later use
echo $page->text1()->collectFootnotes();
echo $page->text2()->collectFootnotes();

// returns the footnotes container with all collected footnotes and clears the memory
echo Footnotes::footnotes();