To change line length try adding ?preferredLineLength=whatever to the URL |
"; $lineLength=0; $tempString=""; $spaceLoc=0; while (!feof($fp)) { // While we haven't reached the end of the file yet $curChar = fgetc($fp); if ($curChar == " ") { $spaceLoc = ftell($fp); } else if ($curChar=="\n") { $currentLoc=ftell($fp); $nextChar=fgetc($fp); if($nextChar=="\n") { print "$tempstring
";
$tempstring="";
$lineLength=0;
continue;
} else {
fseek($fp,$currentLoc);
}
}
$tempstring = $tempstring.$curChar;
$lineLength++;
if($lineLength>=$preferredLineLength) {
$curLoc = ftell($fp);
$difference = $curLoc - $spaceLoc;
if ($difference == 0) {
$tempstring = $tempstring."
\n";
print "$tempstring";
$tempstring="";
$lineLength=0;
continue;
} else if($difference<$preferredLineLength/4){ /* if the difference is bigger than twenty, sod that, the line will be stupidly far wrapped*/
$tempstring = substr($tempstring, 0, (strlen($tempstring)-$difference))."
\n";
print "$tempstring";
$tempstring="";
$lineLength=0;
fseek($fp, $spaceLoc);
} else if ($difference >= $preferredLineLength/4) {
print "$tempstring -
";
$tempstring="";
$lineLength=0;
}
}
}
print "$tempstring
"; ?>