|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
krone Smarty Rookie
Joined: 17 Apr 2013 Posts: 6
|
Posted: Thu Apr 25, 2013 11:53 am Post subject: Pagination |
|
|
I have a huge problem. I have a pagination made and working in php, and i don't have a clue hot to make this work with smarty. I have tried everything. Please help.
$rs = mysql_query("SELECT count(*) FROM numbers");
$rw = mysql_fetch_array($rs);
if( !(isset($_GET['page'])) )
$start = $rw[0] - 5;
else{
$start = $rw[0] - ($_GET['page'] * 5);
}
$res = mysql_query("SELECT * FROM numbers LIMIT $start, 5")
or Die("More entries coming, stay tuned!");
?>
<html>
<body>
<ul>
<?php
while( $row = mysql_fetch_array($res) ){
echo "<li>$row[number]</li>";
$num = "";
$smarty->assign ('num_',$num);}
?>
</ul>
<ul>
<li class="pagination"><a href="index.php?page=<?php
if(isset($_GET['page']))
$next = $_GET['page'] -1;
else
$next=2;
echo $next; ?>"<a>prev</a>
<li class="pagination"><a href="index.php?page=<?php
if(isset($_GET['page']))
$next = $_GET['page'] +1;
else
$next=2;
echo $next; ?>"<a>next</a>
</li>
</ul> |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|