İlgili Kısım
<?php $limit = 25;
$page = @$_GET["page"];
if(empty($page) or !is_numeric($page)) {
$page = 1;
}
$count = mysql_num_rows(mysql_query("SELECT id FROM galeri order by id desc"));
$toplamsayfa = ceil($count / $limit);
$baslangic = ($page-1)*$limit;
if($toplamsayfa < @$_GET["page"]){ echo '<meta http-equiv="refresh" content="0;URL=404.php">'; exit(); }else{ }
$sorustur = "SELECT * FROM galeri ORDER BY id desc LIMIT $baslangic,$limit";
$yazdir_sorgu = mysql_query($sorustur) or die(mysql_error());
if(mysql_num_rows($yazdir_sorgu)=="0"){ echo '<font color="blue"><b>Eklenmiş bir galeri bulunamadı! Lütfen daha sonra tekrar deneyin.</b></font>'; }else{
while ($yazdir = mysql_fetch_array($yazdir_sorgu)){ ?>
<div style="float:left; width:33%; text-align:center;">
<?php if($print['seourl']==".php"){ ?>
<a href="referans.php?url=<?php echo $yazdir['sefurl']; ?>"><img src="<?php echo $yazdir['resimyolu']; ?>" width="198" height="131" title="<?php echo $yazdir['baslik']; ?>" alt="" />
<?php }elseif($print['seourl']==".html"){ ?>
<a href="referans-<?php echo $yazdir['sefurl']; ?>.html"><img src="<?php echo $yazdir['resimyolu']; ?>" width="198" height="131" title="<?php echo $yazdir['baslik']; ?>" alt="" /><?php } ?>
<p><?php echo $yazdir['baslik']; ?></p></a>
</div>
<?php
} } echo '</ul>';
echo '<p align="center" style="padding-top:20px; font-size:13pt;">';
if($count > $limit) :
$x = 2;
$lastP = ceil($count/$limit);
if($page > 1){
$onceki = $page-1;
echo "<a href=\"?page=$onceki\">Geri</a> ";
}
if($page==1) echo "<b>1</b> ";
else echo "<a href=\"?page=1\">1</a> ";
if($page-$x > 2) {
echo "...";
$i = $page-$x;
} else {
$i = 2;
}
for($i; $i<=$page+$x; $i++) {
if($i==$page) echo "<b>$i</b> ";
else echo "<a href=\"?page=$i\">$i</a> ";
if($i==$lastP) break;
}
if($page+$x < $lastP-1) {
echo "...";
echo "<a href=\"?page=$lastP\">$lastP</a>";
} elseif($page+$x == $lastP-1) {
echo "<a href=\"?page=$lastP\">$lastP</a>";
}
if($page < $lastP){
$sonraki = $page+1;
echo "<a href=\"?page=$sonraki\">İleri</a>";
}
endif;
echo '</p>'; ?>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 templatemo-about-right">
<img src="images/referans.png" alt="referans">
</div>
</div>
</div>
</section>
<?php include("inc/footer.php"); ?>