Originally posted by ionutvmi
View Post
Pages help...
Collapse
X
-
dont have any thanx ori and ionutvmi...i made the code here it is i use a functionOriginally posted by hiddenjuz copy it from any toplist sccript
function pages($num_pages, $page, $link )
{
if($num_pages > 1)
{
if($page > 1 )
{
$ppage = $page-1;
echo '<a href="'.$link.'&page='.$ppage.'">«</a>';
echo ' | ';
}else{
echo '«';
echo ' | ';
}
for ($i = 1; $i <= $num_pages; $i++)
{
if($page == $i)
{
echo '<b>'.$i.'</b>';
echo ' | ';
}else{
echo '<a href="'.$link.'&page='.$i.'">'.$i.'</a>';
echo ' | ';
}}
if(($page < $num_pages) && ($num_pages > 1))
{
$npage = $page+1;
echo '<a href="'.$link.'&page='.$npage.'">»</a>';
}else{
echo '»';
}
}
}
Leave a comment:
-
PHP Code:<?
// wap-landz.tk
function pagination($total,$current,$perpage='10',$url=''){
if($total >= $perpage){
$totalpages=round($total/$perpage);
$totalpages2=$total/$perpage;
if($totalpages2>$totalpages)
$totalpages=$totalpages+1;
$pagesar['First'] = "1";
if($current > 1){
$cd=$current-1;
$pagesar['Prev'] = $cd;
if($cd==1)
$st=1;
else if($cd==2)
$st=$cd-1;
else if($cd>=3)
$st=$cd-2;
for($i=$st;$i<=$cd;$i++){
$pagesar[$i] = $i;
}
}
if($totalpages > $current+4)
$finalstop=$current+4;
else
$finalstop=$totalpages;
for($j=$current;$j<=$finalstop;$j++){
$pagesar[$j] = $j;
}
if($totalpages > $current)
$pagesar['Next'] = $current+1;
$pagesar['Last'] = $totalpages;
}else{
$pagesar['1'] = "1";
}
if(is_array($pagesar))
{
print "Pages: ";
foreach($pagesar as $key => $val)
{
if($val == $current)
{ print $key." "; }
else{ print "<a href=\"".$url."?page=$val\">".$key."</a> "; }
}
}
}
// how to use
$c=$_GET['page'];
if (!$c) $c=1;
pagination(24,$c,5);
?>
Leave a comment:
-
this might be bit complicated but shows 4 page number before and after current page but only if they exist
PHP Code:$num_pages = ceil($smileys/$imagesperpage);
if ($_GET['page'] - 4 < 1) $pagemin = 1;
else $pagemin = $_GET['page'] - 4;
$maxPage = $num_pages;
if ($_GET['page'] + 4 > $maxPage) $pagemax = $maxPage;
else $pagemax = $_GET['page'] + 4;
if ($_GET['page'] > 1) $controls .= "<a href=\"".$action."extras".$mod."smileys&page=".($_GET['page']-1)."\">Prev</a>\n";
else $controls .= "Prev\n";
for($page = $pagemin; $page <= $pagemax; $page++)
{
if ($page == $_GET['page']) $controls .= " $page \n";
else $controls .= " <a href=\"".$action."extras".$mod."smileys&page=$page\">$page</a> \n";
}
if ($_GET['page'] < $num_pages) $controls .= "<a href=\"".$action."extras".$mod."smileys&page=".($_GET['page']+1)."\">Next</a>";
else $controls .= "Next";
if ($page > 1 || $smileys > ($page*$imagesperpage)) $controls .= "<br/>";
Leave a comment:
-
can any one help me a example of whati want is right here on the right at the bottom where Page 1 of 2 [1][2][>][Last>>] thats how i want it
Leave a comment:
-
check this it wil help u i am uploading pager files and its examplesAttached Files
Leave a comment:
-
$i is just a varible it could be anything eg:
for ($something_else = $ppage; $something_else <= ($page+5); $something_else++) {
Leave a comment:
-
try
PHP Code:if($page>1){
$ppage = $page-1;
echo "<a href=\"index.php?page=$ppage\">«Prev</a> ";
}
$capped_pages = $total_pages-4;
if($page==1){
for ($i = $page; $i <= ($page+5); $i++) {
if($i<=$total_pages){
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
}
else if($page<$capped_pages){
for ($i = $ppage; $i <= ($page+5); $i++) { //previous page added here also ...so if on page 3 it shows pages 23456
if($i<=$total_pages){
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
}
else{
for ($i = ($total_pages-5); $i <= ($page+5); $i++) { //show total pages (dont go over (capped))
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
if($page<$total_pages){
$npage = $page+1;
echo "<a href=\"index.php?page=$npage\">Next»</a>";
}
Leave a comment:
-
still doesnt work...i thank u for helping i have 10 messages per page and there is only 2 messages on the first page and it that code is showing this
[][1][2][3][4][5][6]
Leave a comment:
-
PHP Code:if($page>1){
$ppage = $page-1;
echo "<a href=\"index.php?page=$ppage\">«Prev</a> ";
}
$capped_pages = $total_pages-4;
if($pages<$capped_pages){
for ($i = $ppage; $i <= ($page+5); $i++) { //previous page added here also ...so if on page 3 it shows pages 23456
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
else if($page==1){
for ($i = $page; $i <= ($page+5); $i++) {
if($i<=$total_pages){
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
}
else{
for ($i = ($total_pages-5); $i <= ($page+5); $i++) { //show total pages (dont go over (capped))
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
if($page<$total_pages){
$npage = $page+1;
echo "<a href=\"index.php?page=$npage\">Next»</a>";
}
Leave a comment:
-
having a problem with the code when nothing is on the page its showing [][1][2][3][4][5] its showing that when nothing is on the page i want it to be blank until there is something on the page it will show [1][2]etc....please fix
Leave a comment:
-
Originally posted by something else View PostPHP Code:if($page>1){
$ppage = $page-1;
echo "<a href=\"index.php?page=$ppage\">«Prev</a> ";
}
$capped_pages = $total_pages-4;
if($pages<$capped_pages){
for ($i = $ppage; $i <= ($page+5); $i++) { //previous page added here also ...so if on page 3 it shows pages 23456
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
else if($page==1){
for ($i = $page; $i <= ($page+5); $i++) {
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
else{
for ($i = ($total_pages-5); $i <= ($page+5); $i++) { //show total pages (dont go over (capped))
echo "<a href=\"index.php?page=$i\">[$i] </a> ";
}
}
if($page<$total_pages){
$npage = $page+1;
echo "<a href=\"index.php?page=$npage\">Next»</a>";
}
thank u so much am going to try it....
Leave a comment:
Leave a comment: