 |
|
ภาพไฟล์ทั้งหมด

คือตอนแรก ผม สร้างไฟล์ mkv.inc.php อันนี้คือ code ครับ
Code (PHP)
<style type="text/css">
a:link {
font-family: Tahoma, Geneva, sans-serif;
color: #7a7a7a;
font-size: 12px;
text-decoration: none;
}
a:hover {
font-family: Tahoma, Geneva, sans-serif;
color: #fc417a;
font-size: 12px;
text-decoration: none;
}
a:visited {
font-family: Tahoma, Geneva, sans-serif;
color: #7a7a7a;
font-size: 12px;
text-decoration: none;
}
a:active {
font-family: Tahoma, Geneva, sans-serif;
color: #ed51a9;
font-size: 12px;
text-decoration: none;
}
</style>
<?php
function testOne(){
$quotes = array(
"<a href=http://www.google.co.th><img src=mkv/iron1.jpg alt=iron1 border=0 width=109 height=162 rel=<h1> test1 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/gi.jpg alt=G.I.Joe border=0 width=109 height=162 rel=<h1> test2 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/tron.jpg alt=tron border=0 width=109 height=162 rel=<h1> test3 </a>",
"<a href=http://www.google.co.th><img src=mkv/pirates4.jpg alt=pirates4 border=0 width=109 height=162 rel=<h1> test4 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/wall.jpg alt=wall-e border=0 width=109 height=162 rel=<h1> test5 </a>",
"<a href=http://www.google.co.th><img src=mkv/green.jpg alt=green border=0 width=109 height=162 rel=<h1> test6 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/Priest.jpg alt=Priest border=0 width=109 height=162 rel=<h1> test7 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/thor.jpg alt=thor border=0 width=109 height=162 rel=<h1> test8 </a>",
"<a href=http://www.google.co.th><img src=mkv/transformers3.jpg alt=transformers3 border=0 width=109 height=162 rel=<h1> test9 </h1></a>",
);
echo $quotes[rand(0, count($quotes) - 1)];
$ran = $quotes[rand(0, count($quotes) - 1)];
}
function testtwo(){
$quotes = array(
"<a href=http://www.google.co.th><img src=mkv/iron1.jpg alt=iron1 border=0 width=109 height=162 rel=<h1> test1 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/gi.jpg alt=G.I.Joe border=0 width=109 height=162 rel=<h1> test2 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/tron.jpg alt=tron border=0 width=109 height=162 rel=<h1> test3 </a>",
"<a href=http://www.google.co.th><img src=mkv/pirates4.jpg alt=pirates4 border=0 width=109 height=162 rel=<h1> test4 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/wall.jpg alt=wall-e border=0 width=109 height=162 rel=<h1> test5 </a>",
"<a href=http://www.google.co.th><img src=mkv/green.jpg alt=green border=0 width=109 height=162 rel=<h1> test6 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/Priest.jpg alt=Priest border=0 width=109 height=162 rel=<h1> test7 </h1></a>",
"<a href=http://www.google.co.th><img src=mkv/thor.jpg alt=thor border=0 width=109 height=162 rel=<h1> test8 </a>",
"<a href=http://www.google.co.th><img src=mkv/transformers3.jpg alt=transformers3 border=0 width=109 height=162 rel=<h1> test9 </h1></a>",
);
echo implode($quotes);
}
?>
ส่วนไฟล์ random.php เอาไว้ include จาก mkv.inc.php (เอาไว้ แรนด้อม ภาพ)
อันนี้คือ code ครับ
Code (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>
</head>
<body>
<table width="116" border="0" cellspacing="0" cellpadding="5">
<tr>
<td height="250" align="center" valign="top" bgcolor="#e9faed"><? include('mkv.inc.php'); testone(); ?></td>
</tr>
</table>
</body>
</html>
ทุกอย่างก็ปกติดี แต่พอมาถึง อันนี้สิครับ ผมไปไม่เป็นเลยครับ - -*
ไฟล์ showall.php ซึ่งเอาไว้ โชว์รูปใน array ทั้งหมดนะครับ
อันนี้ code ครับ
Code (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>
</head>
<body>
<table width="116" border="0" cellspacing="0" cellpadding="5">
<tr>
<td height="250" align="center" valign="top" bgcolor="#e9faed"><? include('mkv.inc.php'); testtwo(); ?></td>
</tr>
</table>
</body>
</html>
ซึ่ง ผลลัพธ์ ที่ได้ จะเป็น แบบนี้ครับ คือเรียงลงไปเรื่อยๆ

สิ่งที่ผมต้องการคืออยากให้มัน เป็นนี้นะครับ

อยากให้เรียงมาเป็น 4 คอลัมน์ในตาราง พอครบ 4 ก็ เพิ่ม rows ไปอีก เป็นแบบนี้ไปเรื่อยๆ นะครับ
คือผมต้องแก้ไฟล์ไหนบ้างอะครับ ทำมา 2 คืนแล้วยังไม่ได้เลย ครับ ขอบคุณที่ช่วยตอบนะครับ พึ่งโพส ครั้งแรก ผิดผลาดอย่างใด ขออภัยด้วยนะครับ
Tag : PHP, HTML/CSS
|
ประวัติการแก้ไข 2011-10-18 20:14:25
|
 |
 |
 |
 |
Date :
2011-10-18 07:29:36 |
By :
mysuerte |
View :
1006 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |