Tuesday, 4 January 2022

PHP#14MySQL#10 - tintuc.sql - Menu (Chính thức làm web tin tức) tinxemnhieu.php , tinnoibat.php, tinmoi.php

//tinxemnhieu.php

<style type="text/css">
<!--
#tinxemnhieu {
	width: 250px;
	border: 1px solid #0099CC;
	overflow: hidden;
	white-space: nowrap;
}
#tinxemnhieu  h4 {
	background-color: #0099CC;
	margin-top: 0px;
	margin-bottom: 0px;
	padding-top: 5px;
	padding-bottom: 5px;
	padding-left: 10px;
	color: #FFFF00;
}
#tinxemnhieu a {
	color: #CC3399;
	text-decoration: none;
}
#tinxemnhieu a:hover {
	color: #FFCC00;
}
#tinxemnhieu p {
	margin-top: 0px;
	margin-bottom: -1px;
	background-color: #FFFFCC;
	padding-top: 5px;
	padding-bottom: 5px;
	padding-left: 10px;
	border: 1px solid #0099CC;
}
-->
</style>


<div id="tinxemnhieu">
<h4>TIN XEM NHIỀU</h4>
<?php 
	$link=@mysqli_connect("localhost","root","") or die("Không tìm thấy Sever");
	mysqli_select_db($link,"tintuc") or die("Không tồn tại DB");
	mysqli_query($link,"set names 'utf8'");
	$sl="select * from tin  WHERE lang='vi' and AnHien=1 order by SoLanXem DESC limit 0,10";
	$kq=mysqli_query($link,$sl);
	while($d=mysqli_fetch_array($kq))
	{
?>
<p> <a href="#"> <?php echo $d['TieuDe'];?> </a>  </p>
<?php }?>
</div>


//tinnoibat.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#tinnoibat {
	border: 1px solid #993300;
	width: 460px;
	min-height: 300px;
}
#tinnoibat #top1 {
	min-height: 140px;
	margin-bottom: 5px;
	border-bottom-width: 1px;
	border-bottom-style: dotted;
	border-bottom-color: #993300;
}
#tinnoibat #top3 div {
	width: 33.3%;
	float: left;
	text-align: center;
}
#tinnoibat #top3 a {
	color: #006699;
	text-decoration: none;
}
#tinnoibat #top1 img {
	margin-right: 5px;
}
#tinnoibat #top1 p {
	margin-top: 0px;
}
#tinnoibat #top1 a {
	font-size: 18px;
	color: #CC0033;
	text-decoration: none;
}
-->
</style>
</head>

<body>
<div id="tinnoibat">
<?php 
	include("connect.php");
	$sl="select * from tin where lang='vi' and TinNoiBat=1 and AnHien=1 order by idTin DESC limit 0,4";
	$kq=mysqli_query($link,$sl);
	//Lấy dòng đầu tiên( lấy ra rồi là lấy luôn)
	$d=mysqli_fetch_array($kq)

?>
    <div id="top1">
    <img width=150 height=120 align=left src="<?php echo $d['urlHinh'];?>" />
        <p><a href="#"> <?php echo $d['TieuDe'];?> </a> </p>
        <?php echo $d['TomTat'];?>    
    </div> 

    
   
    <div id="top3">
    <?php 
	while($d=mysqli_fetch_array($kq))
	{
	?>
		<div> 
        <img src="<?php echo $d['urlHinh'];?>" width="140" height="90" /><br />
         <a href="#"> <?php echo $d['TieuDe'];?> </a> 
         </div>
         <?php }?>
    </div>

</div>

</body>
</html>

//tinmoi.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

#tinmoi {width: 660px;}

#tinmoi .tinmoinhat {
	width:330px;
	float:left;
	color:#336699;
	height: 175px;
}

#tinmoi .tinmoitieptheo {
	float:left;
	width:329px;
	height: 175px;
	overflow: hidden;
	white-space: nowrap;
	border-left: dotted 1px #030;
}
#tinmoi .theloai {
	font-size:18px; background-color:#003300; color:#FFF;
	padding-top:5px; padding-bottom:5px; clear:left
}
#tinmoi .theloai a {
	color:#9C0; text-decoration:none; margin-left:5px; font-size:16px;}
#tinmoi .theloai a:hover{ color:#6CC; text-decoration:underline; }

#tinmoi  .tinmoinhat a {
	text-decoration:none; color:#003366; 
	font-size:16px; font-weight:bold
}
#tinmoi .tinmoinhat a:hover{ text-decoration:underline; color:#C09}
#tinmoi .tinmoinhat img {	margin-right: 5px; }

#tinmoi .tinmoitieptheo a {
	text-decoration:none;
	color:#003333
}
#tinmoi .tinmoitieptheo a:hover{text-decoration:underline; color:#C09}
#tinmoi .tinmoitieptheo p {
	margin-top:10px; margin-bottom:10px; padding-left:5px;
}

</style>
</head>

<body>
<div id="tinmoi">
<?php 
	include('connect.php');
	$sl="select * from theloai where lang='vi' and AnHien=1 order by ThuTu ASC";
	$kq=mysqli_query($link,$sl);
	while($d=mysqli_fetch_array($kq))
	{
?>
  <div class="theloai"> <?php echo $d['TenTL'];

  $sl2="select * from loaitin where idTL={$d['idTL']} order by ThuTu ASC";
  $kq2=mysqli_query($link,$sl2);
  while($d2=mysqli_fetch_array($kq2))
  {
  ?> 
      <a href="#"> <?php echo $d2['Ten'];?>  </a> <?php }?>
  </div>

  <!-- div theloai -->
  <div class="tinmoinhat">
    <a href="#"> Những thảm họa hàng không ở New York </a>
    <p> <img src="hinh/tm1.jpg" width="80" height="80" align="left" />
      Khủng bố lái máy bay đâm thẳng vào tòa tháp đôi của Trung tâm Thương mại Quốc tế; một 
      khu vực lớn trên mặt đất ngập lửa khói vì máy bay lao xuống. Dưới đây là hình ảnh các 
      thảm họa hàng không từng xảy ra ở New York, Mỹ.      
    </p>
  </div> <!-- tinmoinhat -->
  <div class="tinmoitieptheo">
    <p> <a href="#"> Trục vớt máy bay lao xuống sông  </a> </p>
    <p> <a href="#"> Máy bay chở hàng trăm khách  khách lao xuống sông  New York</a> </p>
    <p> <a href="#"> Người hùng trong cú hạ cánh kỳ diệu ở   New York </a> </p>
	<p> <a href="#"> Tại sao chim có thể làm rơi máy bay  </a> </p>
    <p> <a href="#"> 'Thật thần kỳ, anh ấy cho máy bay nổi trên sông' </a> </p>	
  </div>  <!-- div id=tinmoitieptheo -->
  <?php }?>
  


</div><!-- tinmoi -->


</body>
</html>

0 comments:

Post a Comment