beastbytes / yii2-footnotes
一个简化网页中脚注添加和管理的Yii2扩展;它生成可访问的、自动编号的脚注。
v1.0.0
2015-07-26 20:46 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-19 10:03:06 UTC
README
一个简化网页中脚注添加和管理的Yii2扩展;它生成可访问的、自动编号的脚注。
受到使用CSS的可访问脚注文章的启发。
有关许可信息,请查看LICENSE文件。
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require --prefer-dist beastbytes/yii2-footnotes
或
"beastbytes/yii2-footnotes": "*"
将以下内容添加到您的composer.json文件的require部分:
用法
在视图中
$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
示例
$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