I did a little footnote function today, if anybody can use one.
- Code: Select all
<?php
$footnotes = array(0 => 'empty');
function footnote ($foottext){
global $footnotes;
global $foottext;
array_push($footnotes, $foottext);
end ($footnotes);
$footnumber = key($footnotes);
$ft = $foottext;
echo "<a href=\"#fn$footnumber\"><span
class=\"fn\">$footnumber</a></span>";
}
function footnote_print () {
global $footnotes;
echo '<div class="fns"><h4> Footnotes </h4>';
reset ($footnotes);
next ($footnotes);
foreach ($footnotes as $k => $v) {
if ($k >= 1) {
echo "<a name=\"fn$k\"> $k. $v</a><br />";
}
}
}
?>
Suggestions for improvement are welcome. It works like a dream except I haven't figured out how to style the text size or vertical-align of the footnote number yet.
To use it, type
- Code: Select all
<p> I am examining my lovely belly button.';
<?php
$foottext = 'When the first man was born, he did not have a belly button. Booor-ing.';
footnote ($foottext);
?>
</p>
yada yada yada
--- and at the end of the text section, or wherever you want it ---
<? php
footnote_print();
?>