<?php
$text = "chat.txt";
$datei = file($text);
$zaehler = count($datei) - 1;
print "<div id="chaten">$datei[$zaehler]</div>";
?>
oder im Head der HTML-Seite:
<?php
$text = "chat.txt";
$datei = file($text);
$zaehler = count($datei) - 1;
print "<script language="javascript">";
print "function init()";
print "{";
print " chaten.innerText = "$datei[$zaehler]"";
print "}";
print "</script>";
?>
und:
<body onload="init();">
<div id="chaten">sdffasd</div>