Footnotes

Summary: Simple footnote markup
Version: 2022-07-17
Prerequisites: pmwiki 2.0 and above
Status: Stable
Maintainer: SaidAchmiz
License: GPL2+
Discussion: Footnotes-Talk
Download: footnote2.phpΔ

Questions answered by this recipe

Is there a way to automatically number footnotes and to have them all automatically displayed at the bottom of the page?

Installation

Download footnote2.phpΔ, and place it in your cookbook directory. Add the following line to local/config.php

include_once("$FarmD/cookbook/footnote2.php");

Configuration

$FootnoteBacklinkCharacter

The $FootnoteBacklinkCharacter config variable defines the link text of back-to-citation links in footnotes. (Default is ⇑, i.e.: ⇑.)

$FootnoteBlockStartLine

The $FootnoteBlockStartLine, if set to false, disables the blue line that precedes the footnote section. (Default is true.) This saves you from having to change all instances of [^#^] to [^@^], and vice-versa, if you want to change whether the blue line is shown.

Usage

Wherever you want a footnote in your text, simply use the [^footnote text^] markup.

When you want to display all the footnotes you have so far, below a short blue horizontal rule, use the markup [^#^] (on a line by itself; it won't break the recipe to do otherwise, but it might look funky). (The blue line will only appear when footnotes actually exist on the page.)

If you do not want the short blue horizontal rule, but just a listing of all the footnotes defined so far, use the markup [^@^] (on a line by itself, too).

You may have multiple occurrences of the listing markups; each one will display only the footnotes created in the text since the last listing markup. (So you can have footnotes at the end of each section of your text, for example.)

You can put in the group footer the markup to display the footnotes, so authors don't have to remember to add it.

New in version 2022-07-17

Added the $FootnoteBlockStartLine config variable (see above).

Notes

The original versionΔ of this recipe was extracted from MarkupExtensions for those of us who just want footnote capability without all the other extensions provided by that recipe.

The new version is compatible with PmWiki 2.2.58 and newer, and has no requirements for PHP version. The original version is compatible with PmWiki 2.0 and higher, but requires PHP 5.4 or older.

Release Notes

  • 2022-07-17: Updated for compatibility with PHP 8. Added $FootnoteBlockStartLine config parameter. Many bug fixes. SaidAchmiz
  • 2017-12-30: Incorporate features of FootnotesExtended. —Said Achmiz December 30, 2017, at 08:13 PM
  • 2017-12-07: Footnotes can now span multiple lines and even multiple paragraphs. —Said Achmiz December 07, 2017, at 03:57 PM
  • 2017-11-06: Updated to be valid HTML5. —Said Achmiz November 06, 2017, at 03:46 PM
  • New version that works in PHP 5.5+, and prevents gratuitous blue lines: footnote2.phpΔ
  • Slightly modified variant of original recipe to prevent gratuitous blue lines (<PHP 5.5): footnoteifany.phpΔ

See Also

  • MarkupExtensions
  • FootnotesExtended (an extension that makes separating the footnote text from the footnote reference possible; better for large footnote texts and if references to the same text reoccur)
  • Cookbook:AddFootnote - creates a GUI edit button to transform selected text into a footnote

Contributors

  • jr (the MarkupExtensions recipe)
  • TonyColley
  • RandyB - modified to omit gratuitous blue lines and to work with PHP 5.5
  • Said Achmiz - modified to be valid HTML5, and to allow footnotes to span multiple lines/paragraphs; also, added features of FootnotesExtended

Comments

See discussion at Footnotes-Talk

User notes +7: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.