• 04-10-2008, 04:02:04
    #1
    Bir sürü konu okudum şu iki saat içinde girip çıkmadığım site/konu kalmadı ama işte bir türlü beceremedim aslında db'den alıp sayfalamayı başardım ama şu koda entegre edemedim bir türlü Yardımcı olabilirsiniz cidden çok sevinirim.

    <?php
    $Category = $_GET['Category'];
    
    $image_path ="../..";
    include_once("skin.php");
    echo $header;
    echo "<h2>$Category wallpapers</h2>";
    
    if ($image_path == "")
    {
    	$image_path=$_SERVER['REQUEST_URI'];
    }
    
    if (substr($image_path,strlen($image_path)-1,1) != "/")
    	$image_path=$image_path."/";
    
    //Category wallpapers.
    #get the category ID
    $cCategory = str_replace("+", " ", $Category);
    $cQuery = "SELECT * FROM `Categories` WHERE `name`='$cCategory' LIMIT 1";
    $cResult = mysql_query($cQuery) or die(mysql_error());
    if (mysql_num_rows($cResult) <= 0)
    {
    	echo "There are currently no wallpapers in this category.";
    } else
    {
    	$Row = mysql_fetch_object($cResult);
    	$id = $Row->id;
    
    	$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') AND `approved` = '0' ORDER BY `ID` DESC");
    	$x = 0;
    	if (mysql_num_rows($result) <= 0)
    	{
    		echo "There are currently no wallpapers in this category.";
    	} else
    	{
    		while ($row = mysql_fetch_assoc($result)) {
    			$x += 1;
    			echo "\n".'<div class="Box Left">'."\n\t";
    				echo '<div style="font-size: 1em; margin-bottom: 5px;"><a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/">'.$row['Title']."</a></div>";
    				echo '<a href="'.$image_path.'wallpaper/'.str_replace(" ", "-", $row['Title']).'/"><img class="Thumbnail" src="image_resize.php?i=images/wallpapers/'.$row['Wallpaper1'].'&amp;w=160&amp;h=160" alt="'.$row['Name'].'" /></a>';
    				echo '<div class="Clear"></div>'."\n";
    			echo '</div>';
    			if (!is_int($x/3)){
    				echo '<div class="Spacer">&nbsp;</div>';
    			}
    		}
    	}
    }
    echo '<div class="Clear"></div>';
    
    echo $footer;
    ?>
  • 07-10-2008, 20:07:16
    #2
    Bir şekilde entegreyi gerçekleştirdim uzun uğraşlar sonucu
    $page=$_GET['page'];
    $limit=$Settings['Cat_Navigation_Count'];
    if ($page==NULL) {
    	$page=1;
    }
    $max_show=5;
    
    $limitvalue = $page * $limit - ($limit);
    
    $cCategory = str_replace("+", " ", $Category);
    $cQuery = "SELECT * FROM `Categories` WHERE `name`='$cCategory' LIMIT 1";
    $cResult = mysql_query($cQuery) or die(mysql_error());
    
    if (mysql_num_rows($cResult) <= 0)
    {
    	$display_pagination=0;
    } else
    {
    	$query_count    = "SELECT * FROM `Wallpapers` WHERE (`Category` = (SELECT `id` FROM `Categories` WHERE `name`='$cCategory') OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = (SELECT `id` FROM `Categories` WHERE `name`='$cCategory'))) AND `approved` = '0' ORDER BY `ID` DESC";
    	$result_count   = mysql_query($query_count);    
    	$totalrows      = mysql_num_rows($result_count);
    	if ($totalrows==0) { $display_pagination = 0; } else { $display_pagination = 1; }
    }
    
    $numofpages = ceil($totalrows / $limit); 
    
    if ($numofpages==1) { $display_pagination=0; }
    
    if ($page > 3) {
    	$start=$page-2;
    	$end=$page+2;
    	if ($page==$numofpages) {
    		$end=$page;
    		$start=$start-2;
    	} elseif ($page+1==$numofpages) {
    		$end=$page+1;
    		$start=$start-1;
    	}
    } else {
    	$start=1;
    	$end=5;
    }
    
    if ($page>=4) {
    	$apagenav='<span class="navigation"><a href="'.$page_isset.'1/">«</a></span> ';
    } else {
    	$apagenav='<span class="navigation">«</span> ';
    }
    
    if ($page < $numofpages) {
    	$aend=' <span class="navigation"><a href="'.$page_isset.$numofpages.'/">»</a></span>';
    } else {
    	$aend=' <span class="navigation">»</span>';
    }
    
    
        for($i = $start; $i <= $end; $i++){
            if($i == $page){
                $apagenav .= '<span class="anavigation">'.$i."</span> ";
            }else{
                $apagenav .= '<span class="navigation"><a href="'.$page_isset.''.$i.'/">'.$i.'</a></span> ';
            }
        }
    	$apagenav.=$aend;
    
    	if ($display_pagination==0) {
    		$apagenav=NULL;
    	}
    sayfalamayı yapıyor gayet güzel ama mesela toplam 2 sayfalık konu var ama genede 5 sayfa olarak gösteriyor O konuda yardımcı olabilirseniz sevinirim