簡単なページネーションのコードをphpで書いたのですが、forループをindex.phpではなくindex.tplに表示したいのですがどうすればいいですか?
ヘルプのリンク: http://www.smarty.net/syntax_comparison
$perPage = 10;
$PaginationSql = mysql_query("SELECT COUNT('ID') FROM VA_VIDEOS");
$Pages = ceil(mysql_result($PaginationSql, 0) / $perPage);
$Page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$Start = ($Page - 1) * $perPage;
$postDate = date("d-m-Y");
srand(time());
$randomNum = (rand()%20);
$sql = mysql_query("SELECT * FROM VA_VIDEOS ORDER BY ID DESC LIMIT ".$Start.", ".$perPage."");
while ($Videos = mysql_fetch_array($sql))
{
$ShowVideos[] = $Videos;
}
if($Page >= 1 && $Page<=$Pages){
echo "<div style='margin-left:20px;'>";
if($Page != 1){print "<b class='pagination'><a href='?page=1'>First</a></b>";}
for($x=1; $x<=$Pages; $x++){
$PaginationNum = ($x == $Page) ? "<b class='page-in'>".$x."</b>" : "<a href='?page=".$x."' class='pagination'>".$x."</a>";
echo $PaginationNum;
}
if($Page != $Pages){
$LastPage = "<b class='pagination'><a href='?page=".$Pages."'>Last</a></b>";
echo $LastPage;
}
echo "</div>";
} else {
print "Error!";
}