Gracias por la respuesta... que rapido!
Pero sigue sin funcionar... culpa mia por no incluir todo el codigo!.
Código PHP:
Ver original<div id="chatbox"><?php
$handle = fopen($room, ""); $contents = fread($handle, 100); echo $contents;
}
?></div>
// pero se me habia olvidado la parte de jquery que afecta al chatbox!!!!!!!!!!
Código Javascript
:
Ver originalfunction loadLog(){
var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
var roomjs = "<?php echo $room; ?>" ;
$.ajax({
url: roomjs,
cache: false,
success: function(html){
$("#chatbox").html(html); //Insert chat log into the #chatbox div
var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
}
},
});
}
setInterval (loadLog, 2500); //Reload file every 2.5 seconds
Y este es el problema, siempre lee el archivo completo $room, y no consigo limitar el tamaño a un numero de bytes concreto.