Hi, i want to have these options:
FirstPage | PreviousPage | 1 2 3 4 5 6 7 8 9 10 | NextPage | Last Page
and show 30 iteams per Page.
what my current coding is doing ryt now:
if i put down 30 iteams per page and it also shows me 30 Pages Links in pagination and effecting my layout… but i only want 10 pages links to be displayed in navigation per page… for example if users are on page 10 show: First Page | Prev Page | 10 11 12 13 14 15 16 17 18 19 20 | Next Page | Last Page
My Script isnt showing me options of FirstPage & LastPage in Pagination.
please help me out.
Index.php
[php]<?php
include “includes/conn_db_connection.php”;
include “includes/function_lib.php”;
$catname=str_replace(’_’, ’ ‘,$_REQUEST[‘catname’]);
$data= mysql_fetch_object($s->getDataWithCondition(‘tbl_category’, "category_name=’$catname’"));
$catid=$data->category_id;
$catid=$_REQUEST[‘cat’];
?>
- Music
- <?php echo ucfirst($catname); ?>
- All Albums
if(empty($cat_data->release_date)){ $rldate='unknown'; } else{ $rldate= date('Y', strtotime($cat_data->release_date)); }
?>
<div class="various" >
<div class="cd_cover">
<div class="imag1"><a href="<?php echo $root; ?>/<?php echo strtolower(str_replace(' ', '_',$catname)); ?>/album-<?php echo $cat_data->album_id;?>/<?php echo strtolower(str_replace(' ', '_',$cat_data->album_name));?>-<?php echo strtolower(str_replace(' ', '_',$cat_data->artist_name));?>/"><img src="<?php echo $root; ?>/<?php echo $cat_data->cover_image_small; ?>" height="76" width="76" /></a></div>
</div>
<div class="tetc">
<div class="ultimet"><a href="<?php echo $root; ?>/artist/<?php echo strtolower(str_replace(' ', '_',$cat_data->artist_name)); ?>-<?php echo $cat_data->artist_id; ?>/"><?php echo $cat_data->artist_name; ?></a></div>
<div class="ultimet"><a href="<?php echo $root; ?>/<?php echo strtolower(str_replace(' ', '_',$catname)); ?>/album-<?php echo $cat_data->album_id;?>/<?php echo strtolower(str_replace(' ', '_',$cat_data->album_name));?>-<?php echo strtolower(str_replace(' ', '_',$cat_data->artist_name));?>/"><?php echo $cat_data->album_name; ?></a></div>
<div class="ultimet"><?php echo $cat_data->album_tracks; ?> tracks</div>
<div class="ultimet"><?php $s->get_litners($cat_data->album_id); ?></div>
<div class="ultimet"><?php echo $rldate; ?>- <?php echo $cat_data->category_name; ?></div>
</div>
</div>
<?php $ct++; } } if($num==0) { ?>
<div style=" font-size:20px;color:#FF0000; height:35px;"> No Record Found in database </div>
<?php } ?>
</div>
</div>
<div class="main" >
<?php if($pageLink[1]) {?>
<strong><?php echo $pageLink[0]; ?></strong>
<div class="mi">
<ul>
<?php echo $pageLink[1]; ?>
</ul>
</div>
<div class="right_arrow"> <strong><?php echo $pageLink[2]; ?></strong> <img src="<?php echo $root;?>/images/righ.png" /> </div>
</div>
<div class="main_breadcum_right"></div>
</div>
<?php } ?>
</div>
<div class="main" style="padding-top:22px; padding-bottom:55px; text-align:center;"> <?php include "includes/middle_bottom.php"?> </div>
</div>
<!-- Right Part end HEre -->
<!-- Right Part Start Here -->
<div class="righta">
<!-- right search strart -->
<?php include "includes/right_search.php"; ?>
<!-- right search End -->
<!-- Right Top 10 Songs start -->
<?php include "includes/right_topsongs.php"; ?>
<!-- Right Top 10 Songs End -->
<!-- Right Sponsers start -->
<?php include "includes/right_sponsers.php"; ?>
<!-- Right Sponsers End -->
</div>
<!-- Right Part End Here -->
<!-- footer Start -->
<?php include "includes/footer.php"; ?>
<!-- footer End -->
Paging.php
[php]
<?php global $offset; function getPagingQuery($sql, $itemPerPage ) { if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $offset = ($page - 1) * $itemPerPage; return $sql . " LIMIT $offset, $itemPerPage"; } function getPagingLink($sql, $itemPerPage , $strGet ='',$search_key) { global $db; $result = mysql_query($sql); $pagingLink = ''; $totalResults =mysql_num_rows($result); $totalPages = ceil($totalResults / $itemPerPage); $numLinks = $itemPerPage; if ($totalPages > 1) { include "includes/conn_db_connection.php"; $ID = $_REQUEST['catname']; $self = $root."/".$ID."-all-albums"; $page_name=basename($_SERVER['PHP_SELF']); if(isset($_REQUEST['profile_id'])!="") { $self=$HTTP_PATH.$page_name."?profile_id=".$_REQUEST['profile_id']; } if (isset($_GET['page']) && (int)$_GET['page'] > 0) { $pageNumber = (int)$_GET['page']; } else { $pageNumber = 1; } if ($pageNumber > 1) { $page = $pageNumber - 1; if ($page > 1) { $prev = "Prev"; } else { $prev = "Prev"; } $first = "First"; } $first = "First"; // nor 'first page' link if ($pageNumber < $totalPages) { $page = $pageNumber + 1; $next = "Next"; $last = "Last"; } else { $next = "Next "; $last = "Last"; } $start = $pageNumber - ($pageNumber % $numLinks) + 1; $end = $start + $numLinks - 1; $end = min($totalPages, $end); $pagingLink = array(); for($page = $start; $page <= $end; $page++) { if ($page == $pageNumber) { $pagingLink[] = "CSS i want it to use for Pagination
[code] ul.pagination li.details{
color:#FFA200;
}
ul.pagination li a
{
color:#333333;
text-shadow:0px 1px #F6F6F6;
padding:6px 9px 6px 9px;
border:solid 1px #B6B6B6;
box-shadow:0px 1px #EFEFEF;
-moz-box-shadow:0px 1px #EFEFEF;
-webkit-box-shadow:0px 1px #EFEFEF;
background:#E6E6E6;
background:-moz-linear-gradient(top,#FFFFFF 1px,#F3F3F3 1px,#E6E6E6);
background:-webkit-gradient(linear,0 0,0 100%,color-stop(0.02,#FFFFFF),color-stop(0.02,#F3F3F3),color-stop(1,#E6E6E6));
}
ul.pagination li
{
padding-bottom:1px;
}
ul.pagination li a:hover,
ul.pagination li a.current
{
color:#FFFFFF;
box-shadow:0px 1px #E7E7E7;
-moz-box-shadow:0px 1px #E7E7E7;
-webkit-box-shadow:0px 1px #E7E7E7;
}
ul.pagination li a:hover,
ul.pagination li a.current
{
color:#893A00;
text-shadow:0px 1px #FFEF42;
border-color:#FFA200;
background:#FFC800;
background:-moz-linear-gradient(top,#FFFFFF 1px,#FFEA01 1px,#FFC800);
background:-webkit-gradient(linear,0 0,0 100%,color-stop(0.02,#FFFFFF),color-stop(0.02,#FFEA01),color-stop(1,#FFC800));
} [/code]
thANKS in advance