https://github.com/beastbytes/yii2-footnotes
Yii2 Extension that simplies adding and management of footnotes on a web page
https://github.com/beastbytes/yii2-footnotes
Last synced: about 1 year ago
JSON representation
Yii2 Extension that simplies adding and management of footnotes on a web page
- Host: GitHub
- URL: https://github.com/beastbytes/yii2-footnotes
- Owner: beastbytes
- License: other
- Created: 2015-07-26T17:31:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-27T09:28:49.000Z (over 10 years ago)
- Last Synced: 2025-02-03T15:55:00.998Z (about 1 year ago)
- Language: PHP
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# yii2-footnotes
Yii2 Extension that simplies adding and management of footnotes on a web page; it
generates accessible, automatically numbered footnotes.
Inspired by the [Accessible Footnotes with CSS](http://www.sitepoint.com/accessible-footnotes-css/) article.
For license information check the [LICENSE](LICENSE.md)-file.
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist beastbytes/yii2-footnotes
```
or add
```json
"beastbytes/yii2-footnotes": "*"
```
to the require section of your composer.json.
## Usage
In a view:
```php
$footnotes = Footnotes::begin(); // Before any footnote references on the page
echo $footnotes->add('Local text', 'Footnote text'); // at every footnote reference
Footnotes::end(); // where the footnotes are to be rendered
```
### Example
```php
$footnotes = Footnotes::begin();
// Can be other view stuff here
echo Html::tag('p', strtr('This example shows how to use the {Footnotes widget}.', [
'{Footnotes widget}' => $footnotes->add('Footnotes widget', 'The Footnotes widget makes it easy to add accessible footnotes.'),
]));
// More view stuff
echo Html::tag('p', strtr('The Footnotes widget uses the {Yii2 framework}.', [
'{Yii2 framework}' => $footnotes->add('Yii 2 framework', 'The Yii2 framework is the best framework for developing web applications.'),
]));
// More view stuff, maybe with some more footnote references
Footnotes::end(); // renders the footnotes
```