Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/news.php

<!DOCTYPE html>
<html lang="en">
<head>   
<title>ข่าวเด่นโรงเรียนเทศบาลวัดชัยชุมพล | CCP</title>     
<meta name="description" content="ข่าวเด่น | โรงเรียนเทศบาลวัดชัยชุมพล | Watchaichumpol municipality school">
<?php include 'head.php'; ?>
</head> 
<?php include 'header.php'; ?>
<?php     
         include 'admin/function_date.php';
?>
   <?php
   //***แบ่งหน้า***//
    $rows = 9;  
    $sqlnum = "SELECT * FROM news where newstype_id = '001'";
    $result = mysqli_query($link, $sqlnum);
    $row = mysqli_num_rows($result);
    $total_page = ceil($row/$rows);
      if(empty($_GET['page'])){ 
              $page=1;
          } else {
              $page=$_GET['page'];
            }  
          if($page>=$total_page) $page=$total_page; 
          $start=($page-1)*$rows;
   //***แบ่งหน้า***//
    
    $newstype_id = 001;
    $sql_type = "SELECT * FROM news INNER JOIN  newstype ON news.newstype_id = newstype.newstype_id WHERE news.newstype_id = $newstype_id ORDER BY news_id DESC Limit $start,$rows";
    $result_type = mysqli_query($link, $sql_type);
    
    //***แบ่งหน้า***//
     if($page > 1)
            {
	    $i = ($rows * ($page-1)) + 1; 
            }
    //***แบ่งหน้า***//
    ?> 
    
<body>
	<!-- Breadcrumb section -->
	<div class="site-breadcrumb">
		<div class="container">
                    <a href="index.php"><i class="fa fa-home"></i> หน้าหลัก</a> <i class="fa fa-angle-right"></i>
			<span>ข่าวเด่นทั้งหมด</span>
		</div>
	</div>
	<!-- Breadcrumb section end -->


	<!-- Courses section -->
	<section class="full-courses-section spad pt-0">
		<div class="container">
			<div class="row">
                            <?php
                            while ($row_type = mysqli_fetch_array($result_type)) {
                                ?> 
                             <?php
                                $date = $row_type['new_date'];
                                $show_date = displaydate($date);
                                ?>
				<!-- course item -->
				<div class="col-lg-4 col-md-6 course-item">
					<div class="course-thumb">
						<img src="admin/images/<?php echo $row_type['news_images']; ?>" alt="">
						<div class="course-cat">
                                                    <a href="news_details.php?news_id=<?php echo $row_type['news_id']; ?>"><span>อ่านต่อ</span></a>
						</div>
					</div>
					<div class="course-info">						
						<h4><?php echo $row_type['news_topic']; ?></h4>
                                                    <p class="card-text"> &nbsp;<?php echo $row_type['topic_detail']; ?>...... </p>   
                                                 <div class="date"><i class="fa fa-calendar-o"></i> <?php echo $show_date; ?> &nbsp;<i class="fa fa-eye"></i> <?php echo $row_type['counter']; ?> ครั้ง</div>         
						<h5 class="cource-price"><i class="fa fa-share-alt"></i> Share : 
                                                     <div class="fb-share-button" 
                                                             data-href="https://www.ccp.ac.th/news_details.php?news_id=<?php echo $row_type['news_id']; ?>" 
                                                             class="fb-xfbml-parse-ignore" data-size="small" data-layout="button_count">
                                                        </div>
                                                </h5>
					</div>
				</div>
				<!-- course item -->
                                <?php  }  ?>
											
			</div>
			<div class="text-center">
                         <!-- แบ่งหน้า -->
                            <ul class="site-pageination">    
                                <li>                                
                                    <a <?php if ($page == 1) echo'class="disabled"'; ?> href="news.php?page=<?php echo $page - 1; ?>">&nbsp;<i class="fa fa-angle-left"></i>  ก่อนหน้า &nbsp;

                                    </a>
                                </li>
                                <?php
                                for ($i = 1; $i <= $total_page; $i++) {
                                    if ($page - 2 >= 2 and ( $i > 2and$i < $page - 2)) {
                                        echo "<li><a href=>...</a></li>";
                                        $i = $page - 2;
                                    }
                                    if ($page + 5 <= $total_page and ( $i >= $page + 3 and $i <= $total_page - 2)) {
                                        echo "<li><a href=>...</a></li>";
                                        $i = $total_page - 1;
                                    }
                                    ?>
                                    <li><a <?php if ($page == $i) echo'class="active"'; ?> href="news.php?page=<?php echo $i; ?>"> <?php echo $i; ?> </a></li>
                                <?php } ?>
                                <li>
                                    <a <?php if ($page == $total_page) echo'class="disabled"'; ?> href="news.php?page=<?php echo $page + 1; ?>" >&nbsp; ถัดไป <i class="fa fa-angle-right"></i>&nbsp; 
                                    </a>
                                </li>
                            </ul>
                         <!-- แบ่งหน้า --> 
		     </div>
		</div>
	</section>
	<!-- Courses section end-->

<?php include 'footer.php'; ?>	
 <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/th_TH/sdk.js#xfbml=1&version=v3.2';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>       
	
</body>
</html>

Zerion Mini Shell 1.0