Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
please help to pagination this
05-11-2016, 06:45 AM
Post: #1
please help to pagination this
<?php
@ require_once('config.php');

$page = intval($_GET['page']);
if($page <= 0)$page = 1;
$page--;
$lmt = $page * 5;
$page++;
$count = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM wap_p_sms"));
$pages = ceil($count[0]/5);
if($pages == "0")$pages = "1";

////////////////////////////////
$PAGE_TITLE="Popular SMS » $WEBSITE_TITLE.";
$PAGE_DESCRIPTION=" Popular SMS - $WEBSITE_TITLE.";
$PAGE_KEYWORDS="$WEBSITE_KEYWORDS.";

include"pheader.php";
include"pleftbar.php";


echo'<div id="middlePan">
<h2>Popular SMS</h2>';


$TOPSMS1=mysql_query("SELECT * from wap_p_sms where approved='1' order by likes desc limit $lmt, 5") or die("0");
while($TOPSMS=mysql_fetch_array($TOPSMS1))
{
$sms=str_replace("\'","'",$TOPSMS['sms']);
$sms=str_replace('\"','"',$sms);
$sms=nl2br($sms);
echo '
<div class="smsRow">
<div class="smsBy"><a href="'.$WEBSITE_URL.'/users/'.$TOPSMS['postbyid'].'/'.HF($TOPSMS['postby']).'.html">'.($TOPSMS['postby']).'</a>
Posted In <a href="'.$WEBSITE_URL.'/sms/'.$TOPSMS['postforum'].'/'.HF($TOPSMS['sname']).'.html">'.($TOPSMS['sname']).'</a></div>
<div class="c0"></div>
<p class="sms">'.$sms.'</p>
<div class="smsInfo">
<div><span id="like'.$TOPSMS['ID'].'"><img src="'.$WEBSITE_URL.'/images/heart.png" alt="Heart" />';

print"<a href=\"#\" onclick=\"new Ajax.Updater('like$TOPSMS[ID]', '$WEBSITE_URL/sms/like/$TOPSMS[ID].html', {asynchronous:true, evalScripts:false});; return false;\">I Like SMS</a>";

echo'
</span> - Like: '.$TOPSMS['likes'].' - SMS Length: '.$TOPSMS['length'].' <br> '.sharer($sms).'</div> </div>
</div>';
}
/* -- pagination start --*/
if(1 < $pages){
echo"<div class='pgn'>";
if($page > 3){echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/1'>«</a></span>";}
if($page > 1){$pp1=$page-1;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$pp1'><</a></span>";}
if($page >= 3){$pp2=$page-2;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$pp2'>$pp2</a></span>";}
if($page >= 2){$pp3=$page-1;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$pp3'>$pp3</a></span>";}
echo"<span class='current'>$page</span>";
if($page <= $pages&&$page<=$pages-1){$np1=$page+1;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$np1'>$np1</a></span>";}
if($page <= $pages-2){$np2=$page+2;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$np2'>$np2</a></span>";}
if($page <= $pages-1){$np3=$page+1;echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$np3'>></a></span>";}
if($page <= $pages-3){echo"<span class='pages'><a href='".$WEBSITE_URL."/popular/$pages'>»</a></span>";}
echo"</div>";
}

/* -- pagination end --*/
echo'</div>';


include"prightbar.php";
include"pfooter.php";


?>
Visit this user's website Find all posts by this user
Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)