All pastes #46637 Raw Edit

itrebal

public php v1 · immutable
#46637 ·published 2006-03-22 20:09 UTC
rendered paste body
<?php$total = 41; //This is actually gotten from the databaseif(!$total){  //Send an error message}else{  echo '<table>';  //  echo '<tr><th>Title</th><th>Subtitle</th><th>Comments</th><th>date</th></tr>';  $page = empty($_GET['page'])?1:$_GET['page'];  $page = (is_numeric($page) && $page > 0)?$page:1;  $perpage = 20;  for($start = ($page-1) * $perpage;$start > $total;$start = ($page-1) * $perpage)    $page--;  $posts = $post->list_posts($perpage, $start, $user->information['id']);  if(!$posts){    //Send error message  }else{    foreach($posts as $c){      //Print the information    }    for($i=1;($i-1)*$perpage <= $total;$i++){      if($i != $page)	echo '[<a href="/?posts&page='.$i.'">'.$i.'</a>]';      else	echo '.'.$i.'.';    }  }}?>