![]() |
документация к версии: 3.3.2 | ||
$path='./';
$file=$path."index.html";
$handle=fopen($file,"r") or die("Error! Can't open file");
$content=fread($handle,filesize($file));
fclose($handle);
# All links from menu
$pattern='/ (.*)<\/div>/isU';
preg_match($pattern,$content,$matches);
$menu=$matches[1];
# Divisions
$pattern='/(.*)<\/b> \n
/isU'; preg_match_all($pattern,$menu,$matches,PREG_SET_ORDER); $divs=$matches; # Parse and make new menu, get links echo " \n\n";
$i=0;
foreach ($divs as $dkey => $div) {
$pattern='/ \n\n"; # Prints index.html content echo pfile($file); # Per each division: prints head, file content, makes link to them... $i=0; foreach ($divs as $dkey => $div) { echo " \n"; echo " ".$div[1].""."\n"; foreach ($div[3] as $lkey => $link) { $i++; echo "\n"; echo " ".$link[2]." (#".$i." ".$link[1].")"."\n"; echo "\n"; echo pfile($link[1]); } } # Gets main text from file and print it function pfile($file) { $handle = fopen($file, "r") or die("Error! Can't open file"); $content = fread($handle, filesize($file)); fclose($handle); $what= '/.* <\/td> | \n'.
'
.*<\/h2> |