<html>
<head>
<title>nieuwssite</title>
</head>
<body>
<?php
$fh = fopen('nieuws.txt', 'r');
$nieuws;
//instellen vanaf welk nieuwsbericht er moet gelezen worden
$startindex = 0;
if(isset($_GET["pag"]))
$startindex = pag*3;
//berichten tot aan startbericht overslaan
for ($i = 1; $i < $startindex; $i++) {
$regel = "";
while((!feof($fh)) && ($regel != "----------"))
$regel = fgets($fh);
}
//de nieuwsberichten ophalen en opslaan
for ($i = startindex; $i <= ($startindex+3); $i++) {
//titels
$nieuws[$i - $startindex] = "<h1>";
if (!feof($fh))
$nieuws[$i - $startindex] += fgets($fh);
$nieuws[$i - $startindex] += "</h1><p>";
//bericht
if (!feof($fh))
$regel = fgets($fh);
while((!feof($fh)) && ($regel != "----------")) {
$nieuws[$i - $startindex] += $regel . "<br />";
$regel = fgets($fh);
}
}
fclose($fh);
//output naar scherm
for ($i = 0; $i < 3; $i++)
echo $nieuws[$i];
?>
</body>
</html>