inhoudsopgave-generator
Gesponsorde koppelingen
PHP script bestanden
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
<?php
function create_toc($text) {
preg_match_all('/<h1 id="(.*?)">(.*?)<\/h1>/si',$text,$matches);
$list = '<ul>';
for($i = 0;!empty($matches[1][$i]);$i++) {
$list .= '<li><a href="#'.$matches[1][$i].'">'.$matches[2][$i].'</a></li>';
}
$list .= '</ul>';
return $list;
}
?>
function create_toc($text) {
preg_match_all('/<h1 id="(.*?)">(.*?)<\/h1>/si',$text,$matches);
$list = '<ul>';
for($i = 0;!empty($matches[1][$i]);$i++) {
$list .= '<li><a href="#'.$matches[1][$i].'">'.$matches[2][$i].'</a></li>';
}
$list .= '</ul>';
return $list;
}
?>