sayfalama yardım

Kodla Büyü

mehmetaltin

Seçkin Üye
Seçkin Üye
Mesajlar
596
arkadaşlar ekte örnekte verdiğim gibi nasıl sayfalama yapabilirim...
 

Ekli dosyalar

  • sayfalama.png
    sayfalama.png
    1.4 KB · Görüntüleme: 950
1-listeleyeceğin kayıtların toplam sayısını bul,
2-bir sayfada kaç kayıt kullancaksan hesabını yap.(örn.17 kayıt)
3-if_then else ile kaçıncı kayıttan başlayacığını bul
aşağıdaki örnek bir kod
if sayfa=ilk then
degisken=0
else
degisken=17*(sayfa-1) gibi
4-görüntüleme yapacağın mysql sorgunun sonuna limit degisken,17 ekle

yukarıdaki işlem basamakları sana bir fikir verir herhalde.
 
hocam onu yapamadım zaten kodları ekledim yardımcı olursanız sevinirim...
Kod:
<?php

/********************************************************/
/* Download stats block v1.0 for Mkportal  1.0          */
/* By: Ice2003                                          */
/* http://www.mkportal.it                               */
/* Copyright  2005 and Beyond by Ice2003                */
/********************************************************/
global $MK_BOARD;
// Edit the 3 first lines to adjust how much you want to show in the block
$maxshow = 50;  // Show how many files to be listed in downloads block
$per_page = 1000;
$downloadstoshow = 100; //  how many files to be listed in most downloads section 
$usemarquee = 1;       //  0=No scrolling , 1=Scolling
$scrolldirection = "Up";  // ummm up=up and down=down , duh ya should know that


// Don't change anything under this line or your server will self destruct :)
$most = "En Çok İndirilen 100 Dosya";
$latest = "►<a href=\"http://egitimciyizbiz.net/index.php?pid=131\">Popüler Dosyalar</a>   ►<a href=\"http://egitimciyizbiz.net/index.php?pid=132\">Son Eklenen Dosyalar</a>  ►<a href=\"http://egitimciyizbiz.net/index.php?ind=downloads&op=submit_file\">Dosya Ekle</a>  ►<a href=\"http://egitimciyizbiz.net/index.php?ind=downloads&op=search\">Dosyalarda Ara</a>";
$totalfiles = "Top. Dosya Sayısı";
$totalcategories = "Kategori Sayısı ";
$totaldownloads = "İndirme Sayısı ";

$content = "";



if ($usemarquee == 0) {
	$content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"870\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Lets show in the block the latest files added 
$content .= "<center><b>".$latest."</b></center>";
$a = 1;

$sayfa = $_GET["sayfa"];
if(($sayfa=="") or !is_numeric($sayfa)){ $sayfa=1; }
$satirsayisi = mysql_num_rows(mysql_query("SELECT id, name FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $per_page"));
$toplamsayfa = ceil($satirsayisi / $maxshow);
$baslangic= ($sayfa-1) * $maxshow;

$sayfalama = "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=1' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>İlk</b></a> ";

for($x=1; $x <= $toplamsayfa; $x++)
{
	if($sayfa == $x){
		$sayfalama .= "<label style='border:1px solid #000000; font-weight:400; padding:1px 3px;'>$x</label> ";
	} else {
		$sayfalama .= "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=$x' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>$x</b></a> ";
	}
}

$sayfalama .= "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=$toplamsayfa' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>Son</b></a>";

$result = mysql_query("SELECT id, name, autore FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $baslangic,$maxshow");

$content .= "<br><hr>".$sayfalama;

$content .= "</div><hr><ul type='disc'>";

//$result = mysql_query( "SELECT id, name FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $maxshow");
while(list($id, $name, $autore) = mysql_fetch_row($result)) {
		$title2 = ereg_replace("_", " ", $name);
	  $content .= "<li><b><a href=\"$this->siteurl/index.php?ind=downloads&op=entry_view&iden=$id$title\"><font size=\"3px\">$title2</font></a></b><br>Gönderen: $autore</li><hr>";
		$a++;                      

}
$content .= "</ul><hr>";

$content .= $sayfalama;

	unset($maxshow);
	unset($mysql_query);
	unset($id);
	unset($name);
	unset($downloads);
?>
 
mehmetaltin' Alıntı:
hocam onu yapamadım zaten kodları ekledim yardımcı olursanız sevinirim...
Kod:
<?php

/********************************************************/
/* Download stats block v1.0 for Mkportal  1.0          */
/* By: Ice2003                                          */
/* http://www.mkportal.it                               */
/* Copyright  2005 and Beyond by Ice2003                */
/********************************************************/
global $MK_BOARD;
// Edit the 3 first lines to adjust how much you want to show in the block
$maxshow = 50;  // Show how many files to be listed in downloads block
$per_page = 1000;
$downloadstoshow = 100; //  how many files to be listed in most downloads section 
$usemarquee = 1;       //  0=No scrolling , 1=Scolling
$scrolldirection = "Up";  // ummm up=up and down=down , duh ya should know that


// Don't change anything under this line or your server will self destruct :)
$most = "En Çok İndirilen 100 Dosya";
$latest = "►<a href=\"http://egitimciyizbiz.net/index.php?pid=131\">Popüler Dosyalar</a>   ►<a href=\"http://egitimciyizbiz.net/index.php?pid=132\">Son Eklenen Dosyalar</a>  ►<a href=\"http://egitimciyizbiz.net/index.php?ind=downloads&op=submit_file\">Dosya Ekle</a>  ►<a href=\"http://egitimciyizbiz.net/index.php?ind=downloads&op=search\">Dosyalarda Ara</a>";
$totalfiles = "Top. Dosya Sayısı";
$totalcategories = "Kategori Sayısı ";
$totaldownloads = "İndirme Sayısı ";

$content = "";



if ($usemarquee == 0) {
	$content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"870\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Lets show in the block the latest files added 
$content .= "<center><b>".$latest."</b></center>";
$a = 1;

$sayfa = $_GET["sayfa"];
if(($sayfa=="") or !is_numeric($sayfa)){ $sayfa=1; }
$satirsayisi = mysql_num_rows(mysql_query("SELECT id, name FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $per_page"));
$toplamsayfa = ceil($satirsayisi / $maxshow);
$baslangic= ($sayfa-1) * $maxshow;

$sayfalama = "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=1' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>İlk</b></a> ";

for($x=1; $x <= $toplamsayfa; $x++)
{
	if($sayfa == $x){
		$sayfalama .= "<label style='border:1px solid #000000; font-weight:400; padding:1px 3px;'>$x</label> ";
	} else {
		$sayfalama .= "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=$x' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>$x</b></a> ";
	}
}

$sayfalama .= "<a href='http://egitimciyizbiz.net/index.php?pid=132&sayfa=$toplamsayfa' style='border:1px solid #6394bd; font-weight:400; padding:1px 3px;'><b>Son</b></a>";

$result = mysql_query("SELECT id, name, autore FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $baslangic,$maxshow");

$content .= "<br><hr>".$sayfalama;

$content .= "</div><hr><ul type='disc'>";

//$result = mysql_query( "SELECT id, name FROM mkp_download WHERE validate = '1' ORDER BY `id` DESC LIMIT $maxshow");
while(list($id, $name, $autore) = mysql_fetch_row($result)) {
		$title2 = ereg_replace("_", " ", $name);
	  $content .= "<li><b><a href=\"$this->siteurl/index.php?ind=downloads&op=entry_view&iden=$id$title\"><font size=\"3px\">$title2</font></a></b><br>Gönderen: $autore</li><hr>";
		$a++;                      

}
$content .= "</ul><hr>";

$content .= $sayfalama;

	unset($maxshow);
	unset($mysql_query);
	unset($id);
	unset($name);
	unset($downloads);
?>
 
BBNET
Geri
Üst