Something like this:
PHP Code:
<?php
$pageNum = isset($_GET['page']) ? (int) $_GET['page'] : 0;
$self = $_SERVER['PHP_SELF'];
// get the text from the file or form mysql database
$string = file_get_contents("D:\test.txt");
// quantity to display
$length = 3000;
// string length
$string_length = strlen($string);
// page number or quantity
$start = $pageNum * $length;
$endif = $string_length - $start;
// Returns the portion of string specified by the start and length parameters
$msg = substr($string, $start, $length);
echo wordwrap($msg, 100, "\n");
echo "\n<br />------<br />\n";
if ($pageNum > 0)
{
$page = $pageNum - 1;
echo '<br/><a href="' . $self . '?page=' . $page . '">prev page</a>';
}
if (($string_length > $length) and ($endif > $length))
{
$page = $pageNum + 1;
echo ' <a href="' . $self . '?page=' . $page . '">next page</a>';
}
Bookmarks