//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; overflow: hidden; } #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="loaitin.php?idLT=<?php echo $d2['idLT'];?>"> <?php echo $d2['Ten'];?> </a> <?php }?> </div> <!-- div theloai --> <?php $sltin="select * from tin where idLT in (select idLT from loaitin where idTL={$d['idTL']} and AnHien=1) and AnHien=1 order by idTin DESC limit 0,6"; $kqtin=mysqli_query($link,$sltin); $dtin=mysqli_fetch_array($kqtin); ?> <div class="tinmoinhat"> <a href="chitiettin.php?idtin=<?php echo $dtin['idTin'];?>"> <?php echo $dtin['TieuDe'];?> </a> <p> <img src="<?php echo $dtin['urlHinh'];?>" width="80" height="80" align="left" /> <?php echo $dtin['TomTat'];?> </p> </div> <!-- tinmoinhat --> <div class="tinmoitieptheo"> <?php while($dtin=mysqli_fetch_array($kqtin)){ ?> <p> <a href="chitiettin.php?idtin=<?php echo $dtin['idTin'];?>"> <?php echo $dtin['TieuDe'];?> </a> </p> <?php }?> </div> <!-- div id=tinmoitieptheo --> <?php }?> </div><!-- tinmoi --> </body> </html>
//chitiettin.php
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php if(isset($_GET['idtin'])) { $idtin=$_GET['idtin']; include("connect.php"); $sltin2="select TieuDe, TomTat, Content from tin where idTin=$idtin"; $kqtin2=mysqli_query($link,$sltin2); $dtin2=mysqli_fetch_array($kqtin2) ?> <h1><?php echo $dtin2['TieuDe'];?></h1> <div><?php echo $dtin2['TomTat'];?></div> <div><?php echo $dtin2['Content'];?></div> <?php }?> </body> </html>//loaitin.php (loại tin, tin, phân trang)<!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style> #main_loai{ width:660px;} .loai_left{ width:250px; float:left; height:160px;} .loai_right{ width:390px; float:right; height:160px; overflow:hidden;} .clear{ clear:both; margin-bottom:10px;} </style> </head> <body> <?php if(isset($_GET['idLT'])) { include("connect.php"); $idLT=$_GET['idLT']; $kq1=mysqli_query($link,"select Ten from loaitin where idLT=$idLT"); $d1=mysqli_fetch_array($kq1); //Phân trang: $stin=10; $kq=mysqli_query($link,"select idTin from tin where idLT=$idLT and AnHien=1"); $tst=ceil(mysqli_num_rows($kq)/$stin); //Tính trang hiện tại: if(isset($_GET['page'])) $page=$_GET['page']; else $page=1; //Tính vị trí lấy dữ liệu: $vt=($page-1)*$stin; ?> <div id="main_loai"> <h2><?php echo $d1['Ten'];?></h2> <?php $sl2="select * from tin where idLT=$idLT and AnHien=1 order by idTin DESC limit $vt,$stin"; $kq2=mysqli_query($link,$sl2); while($d2=mysqli_fetch_array($kq2)){ ?> <div class="loai_left"><img src="<?php echo $d2['urlHinh'];?>" width="250" height="160" alt=""/></div> <div class="loai_right"> <h3><?php echo $d2['TieuDe'];?></h3> <div><?php echo $d2['TomTat'];?></div> </div> <div class="clear"></div> <?php }?> <?php }?> <div>Trang <?php for($i=1;$i<=$tst;$i++){?><a href="?idLT=<?php echo $idLT;?>&page=<?php echo $i;?>"><?php echo $i;?></a> <?php }?></div> </div> </body> </html>
overflow: hidden;
ReplyDeleteChống tràn nội dung
Delete