Page 1 of 1

Pagination from Text data

Posted: Sun Aug 03, 2008 8:51 pm
by new2phpcode
Hi guys,

Is it possible to do pagination wherein the data is coming from a text file, these data are seperated by ".:::.", my simple blog keeps on filling up the pages.....,

Code: Select all

 
$submit     = $_POST["submit"];
$title_blog = $_POST["title_blog"];
$input_blog = $_POST["input_blog"];
$date_blog  = $_POST["date_blog"];
$category_blog = $_POST["category_blog"];
$url_blog = $_POST["url_blog"];
$word_blog = $_POST["word_blog"];
$word_blog2 = $_POST["word_blog2"];
 
if (isset($_POST['submit'])) {
    $filename   = "blog.txt";
 
    $fp         = fopen( $filename,"r"); 
    $OldData    = fread($fp, 80000); 
    fclose( $fp ); 
 
    putenv("TZ=Asia/Manila");     
    $Today = date("D M j, Y g:i:s a T "); 
 
$Input = "<table width='450' border='0' align='center' cellpadding='0' cellspacing='4'><tr><td class='blogtitle'><div align='left'>
$title_blog</div></td></tr><tr><td class='textdraw'><div align='left'>$input_blog</span>$Today</div></td></tr><tr><td class='texttable'><div align='left'>category:$category_blog</div></td></tr><tr><td class='blogtitle'>&nbsp;</td></tr><tr><td class='texttable'><div align='left'><p>$word_blog</p></div></td></tr><tr><td class='texttable'><div align='left'><a href='$url_blog'>read more...</a></div></td></tr><tr><td class='commentsnotestable3'>&nbsp;</td></tr></table>.:::.";
 
    $New = "$Input$OldData";
 
    $fp = fopen( $filename,"w"); 
    if(!$fp) die("&data_blog=cannot write $filename ......&");
    fwrite($fp, $New, 800000); 
    fclose( $fp ); 
}
 
header ("location: blog.php");
 
 
 
?>
 

Re: Pagination from Text data

Posted: Mon Aug 04, 2008 6:25 am
by jayshields
You can paginate anything. Search around this forum for existing snippets.

On a side note, your blog mechanism seems pretty awful. Why not use some existing open source blogging tool? I'm sure you can find a flat-file solution too if you so need it.

Re: Pagination from Text data

Posted: Mon Aug 04, 2008 5:52 pm
by new2phpcode
hahahahaha...My blog is indeed awful, many said so... Thanks for the comment... But im practicing on simple ideas.. ANyways i'll try your advise...Thank you! :D

Re: Pagination from Text data

Posted: Mon Aug 04, 2008 7:03 pm
by RobertGonzalez
Pagination should act on your results in this case. Your results should be an array so paging through that should be a breeze.