1

بابه‌ت: نیشاندانی بابه‌ته‌کانی نێو هاوپۆل بۆ زیاتر له‌ کۆڵۆمێ ؟

ئێستاکه‌ بابه‌تاکانی ناو هاپۆله‌کان یه‌ك بابه‌ت نیشان ده‌دا چۆن وای لێبکه‌م ببێ به‌ زیاتر له‌ کۆڵۆمێ بۆ نیشاندان

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl" lang="en-US"> 
<head> 
<!-- Style --> 
<link rel="stylesheet" type="text/css" media="screen" href="css/pagenavi.css" /> 
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/menu.css" />
<link rel="stylesheet" type="text/css" href="css/style-dreje.css" />
<link rel="stylesheet" type="text/css" href="css/style-hawpol.css" />
</head>
<body>
</body>
</html>
<?php
include("includes/function.php");
    
    if(isset($_GET['hawpol'])){
    $hawpol_id = mysql_real_escape_string($_GET['hawpol']);
    $hawpol_id = intval($hawpol_id);
    

    $tbl_name="babet";
    
    $adjacents = 3;

    $query = "SELECT COUNT(*) as jim FROM $tbl_name";
    $total_pages = mysql_fetch_array(mysql_query($query));
    $total_pages = $total_pages['jim'];
    
    $hawpol = $_GET['hawpol'];
    $targetpage = "hawpol.php?hawpol=$hawpol";     
    
    
    $limit = 3;                                 
    
    $page = $_GET['page'];
    if($page) 
        $start = ($page - 1) * $limit;             
    else
        $start = 0;                            
    
    $sql = "SELECT id, serderr, hawpol, nawerrok,wene ,Barwar FROM $tbl_name WHERE hawpol = '$hawpol_id' ORDER BY id DESC LIMIT $start, $limit";
    $result = mysql_query($sql); 
    
    
    if ($page == 0) $page = 1;                    
    $prev = $page - 1;                            
    $next = $page + 1;                            
    $lastpage = ceil($total_pages/$limit);        
    $lpm1 = $lastpage - 1;                        
    
    $pagination = "";
    if($lastpage > 1)
    {    
        $pagination .= "<div class=\"pagination\"><ul class=\"list\">";
        
        if ($page > 1) 
            $pagination.= "<li><a href=\"$targetpage&page=$prev\">پێشوو</a></li>";
        else
            $pagination.= "<li class=\"disabled\"><span class=\"disabled\">پێشوو</span></li>";    
        
        
        if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up
        {    
            for ($counter = 1; $counter <= $lastpage; $counter++)
            {
                if ($counter == $page)
                    $pagination.= "<li class=\"disabled\"><span class=\"current\">$counter</span></li>";
                else
                    $pagination.= "<li><a href=\"$targetpage&page=$counter\">$counter</a></li>";                    
            }
        }
        elseif($lastpage > 5 + ($adjacents * 2))
        {
            
            if($page < 1 + ($adjacents * 2))        
            {
                for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<li class=\"disabled\"><span class=\"current\">$counter</span></li>";
                    else
                        $pagination.= "<li><a href=\"$targetpage&page=$counter\">$counter</a></li>";                    
                }
                $pagination.= "";
                $pagination.= "<li><a href=\"$targetpage&page=$lpm1\">$lpm1</a></li>";
                $pagination.= "<li><a href=\"$targetpage&page=$lastpage\">$lastpage</a></li>";        
            }
            
            elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
            {
                $pagination.= "<li><a href=\"$targetpage&page=1\">1</a></li>";
                $pagination.= "<li><a href=\"$targetpage&page=2\">2</a></li>";
                $pagination.= "";
                for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<li class=\"disabled\"><span class=\"current\">$counter</span></li>";
                    else
                        $pagination.= "<li><a href=\"$targetpage&page=$counter\">$counter</a></li>";                    
                }
                $pagination.= "";
                $pagination.= "<li><a href=\"$targetpage&page=$lpm1\">$lpm1</a></li>";
                $pagination.= "<li><a href=\"$targetpage&page=$lastpage\">$lastpage</a></li>";        
            }
            
            else
            {
                $pagination.= "<li><a href=\"$targetpage&page=1\">1</a></li>";
                $pagination.= "<li><a href=\"$targetpage&page=2\">2</a></li>";
                $pagination.= "";
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "<li class=\"disabled\"><span class=\"current\">$counter</span></li>";
                    else
                        $pagination.= "<li><a href=\"$targetpage&page=$counter\">$counter</a></li>";                    
                }
            }
        }
        
        
        if ($page < $counter - 1) 
            $pagination.= "<li><a href=\"$targetpage&page=$next\">داهاتوو</a></li>";
        else
            $pagination.= "<li class=\"disabled\"><span class=\"disabled\">داهاتوو</span></li>";
        $pagination.= "</ul></div>\n";        
    }
    }
    
    else{
    echo '<div class="alert alert-warning doidfont">تکایە وشەیەک بنووسە بۆ گەڕان</div>';
    }
?>
<ul>
    <?php
        while($row = mysql_fetch_array($result))
        {
    
        echo ' <p class="a">
        
        <p class="title-readMoreArtcile"><a href="dreje.php?id='.$row['id'].'">'.$row['serderr'].'</a>
        </p>   
    <!--
    <div class="date_main_hawpol">'.$row['Barwar'].'
        </div>
        -->
      <div class="body_hawpol">
       <!--'.snuri_wesha($row['nawerrok'], 14).' -->
               <img src="up/'.$row['wene'].'"          alt="'.$row['serderr'].'">

    </div>
    </p>';
    
        }
    ?>
    </ul>
<?=$pagination?>