Pagination - just want next and previous

0

I am using getPagination(); however all I want is just two simple 'next' & 'previous' buttons.

I had a look at this article which was given an another post: http://www.openscriptsolution.com/2011/04/15/getpagination-options-for-pods-cms-1-9-5-and-wordpress-3-1-1/ but it is far more than I need.

Is anyone able to help me?

asked Sep 5 '11 at 9:34

gabrielle

1

add comment
enter at least 15 characters

1 Answer

0

Yes. Just change the content of pagination_2.php file regarding to that article to become like this, then you should see only Prev and Next link in your pagination:

<style type="text/css">
/* Pod Paging
-------------------------------------------------------------- */
.podPager {padding:0.3em;overflow:hidden;border-top:1px solid #eee;background:#f6f6f6;color:#666;margin-bottom:0.8em; width: 594px;}
.pageNum {padding:0 2px;}
.currentPage {background:#ccc;color:#fff;}
</style>

<?php
$page = $this->page;
$rows_per_page = $this->rpp;
$total_rows = $this->getTotalRows();
$total_pages = ceil($total_rows / $rows_per_page);
$type = $this->datatype;

// Build the $_GET string
$request_uri = "?type=$type&";
foreach ($_GET as $key => $val)
{
  if ('pg' != $key && 'type' != $key && !empty($val))
  {
   $request_uri .= $key . '=' . urlencode($val) . '&';
  }
}
?>
    <div class="podPager">

<?php

  if($total_pages > 1) :
    // echo '<span class="pages">'.$label1.' '.$page.' '.$label2.' '.$total_pages.':</span>';
  endif; 

  if (1 < $page) :
    if($total_pages > 2) : 
      $prev = $page - 1;
      // echo ' <a href="'.$request_uri.'pg=1" class="prevPage">&laquo; '.$label3.' ... </a>';
      echo ' <a href="'.$request_uri.'pg='.$prev.'" class="firstPage">&laquo; '.$label6.'</a>';
    else : 
      //echo ' <a href="'.$request_uri.'pg=1" class="pageNum firstPage">1</a>';
    endif;
  endif; 

  if (1 < ($page - 100)) :
    //echo ' <a href="'.$request_uri.'pg='.($page - 100).'" class="pageNum">'.($page - 100).'</a>';
  endif;

  if (1 < ($page - 10)) :
    //echo ' <a href="'.$request_uri.'pg='.($page - 10).'" class="pageNum">'.($page - 10).'</a>';
  endif; 

  for ($i = 2; $i > 0; $i--) : 
    if (1 < ($page - $i)) : 
      //echo ' <a href="'.$request_uri.'pg='.($page - $i).'" class="pageNum">'.($page - $i).'</a>';                
    endif;
  endfor;

  ?> <span class="pageNum currentPage"><?php echo $page; ?></span><?php

  for ($i = 1; $i < 3; $i++) :
    if ($total_pages > ($page + $i)) :
      //echo ' <a href="'.$request_uri.'pg='.($page + $i).'" class="pageNum">'.($page + $i).'</a>';
    endif;
  endfor;

  if ($total_pages > ($page + 10)) :        
    //echo ' <a href="'.$request_uri.'pg='.($page + 10).'" class="pageNum">'.($page + 10).'</a>';
  endif;

  if ($total_pages > ($page + 100)) :
    //echo ' <a href="'.$request_uri.'pg='.($page + 100).'" class="pageNum">'.($page + 100).'</a>';
  endif; 

  if ($page < $total_pages) : 
    if($total_pages > 2) :
      $next = $page + 1;
      echo ' <a href="'.$request_uri.'pg='.$next.'" class="nextPage">'.$label5.' &raquo;</a>';
      // echo ' <a href="'.$request_uri.'pg='.$total_pages.'" class="lastPage"> ... '.$label4.' &raquo;</a>';
    else:
      echo ' <a href="'.$request_uri.'pg='.$total_pages.'" class="pageNum">2</a>';
    endif;
  endif;

?>
</div>

Does it work for you?

answered Sep 6 '11 at 1:10

Masino Sinaga

41

add comment
enter at least 15 characters