Cũng là dân lính mới tò tè, góp script "require" (hay include), dành cho ai
đó muốn tìm học PHP_Basics như tui.
Chỉ với script "require" ta có thể tạo 1 site theo PHP đơn giản nhứt.
Giả thiết các bạn đã setup tốt Apache - PHP - MySQL vô PC của bạn.
Copy các files sau vô C:\Appser\www\
1/ index.php
<html><head>
<title>php_basics</title>
</head><body>
<?
require("ind_head.inc");
?>
<?
require("ind_left.inc");
?>
<?
require("ind_righ.inc");
?>
<?
require("ind_styl.inc");
?>
<!-- page content -->
<table width="65%" cellpadding = 12 cellspacing =0 border = 0>
<tr><td>
<a name="#up"></a>
<h2>Unconditional love</h2>
<p>A story is told about a soldier who was finally coming home after having
fought in Vietnam. He called his parents from San Francisco.</p>
<p>"Mom and Dad, I'm coming home, but I've a favor to ask. I have a
friend I'd like to bring home with me."</p>
<p>"Sure," they replied, "we'd love to meet him."</p>
<p>"There's something you should know," the son continued,
"he was
hurt pretty badly in the fighting. He stepped on a land mine and lost an arm
and a leg. He has nowhere else to go, and I want him to come live with
us."<br>
"I'm sorry to hear that, son. Maybe we can help him find somewhere to
live."</p>
<p>..........</p>
<p align="center">******</p>
</td></tr>
</table>
<?
require("ind_foot.inc");
?>
</body></html>
___________
2/ File "ind_head.inc"
<html><head>
<title>PHP_BASICS</title>
</head>
<table width="100%" cellpadding = 12 cellspacing =0 border = 0>
<tr bgcolor = aqua>
<td align = left><img border="0" src="../img/stork1.gif" width="104"
height="112"></td>
<td>
<p align=center><font face="Arial" size="9"><b>PHP_BASICS</font></a></b></p>
</font></td>
<td align = right><img border="0" src="../img/stork1.gif" width="104"
height="112"></td></tr>
</table>
<table width = "100%" cellpadding = 4 cellspacing = 4>
<tr bgcolor = #b3b3b3>
<td width = "20%" align="center"> </td>
<td width = "20%" align="center"> </td>
<td width = "20%" align="center"> </td>
<td width = "20%" align="center"> <a href="index.php">ENGLISH</a></td>
<td width = "20%" align="center"> <a href="index.php">FRENCH</a></td>
</table>
<table width = "100%" cellpadding = 4 cellspacing = 4>
<tr >
<td width = "25%" align="center">
</td>
<td width = "25%" align="center">
</td>
<td width = "25%" align="center">
</td>
<td width = "25%" align="center">
</td></tr>
</html>
_____________
3/ File "ind_left.inc"
<html><head><title>PHP_BASICS</title>
</head>
<table cellpadding="2" align="left">
<tr><td>
<p style="background: #c0c0c0">
<img border="0" src="../img/star1.gif" width="16" height="16">
<b><a href="index.php"><font face="Arial" size="2">Home</font></a></b>
</td></tr>
<tr><td>
<p style="background: #c0c0c0">
<img border="0" src="../img/star1.gif" width="16" height="16">
<b><a href="index.php"><font face="Arial" size="2">Unconditional<br>
love</font></a></b>
</td></tr>
<tr><td>
<p style="background: #c0c0c0">
<img border="0" src="../img/star1.gif" width="16" height="16">
<b><a href="index.php"><font face="Arial" size="2">Unconditional<br>
love</font></a></b>
</td></tr>
</table>
</html>
___________
4/ File "ind_righ.inc"
<table border="0" width="13%" cellspacing="10" cellpadding="1"
align="right">
<tr>
<td width="100%">
<p align="center"><img border="0" src="../img/angkor1.jpg" width="120"
height="90"></td>
</tr>
<tr>
<td width="100%">
<p align="center"><img border="0" src="../img/hoguom1.jpg" width="120"
height="75"></td>
</tr>
<tr>
<td width="100%">
<p align="center"><img border="0" src="../img/hue1.gif" width="120"
height="90"></td>
</tr>
<tr>
<td width="100%">
<p align="center"><img border="0" src="../img/nhatrg1.jpg" width="120"
height="80"></td>
</tr>
____________
5/ File "ind_foot.inc"
<html>
<body>
<table width = "100%" cellpadding = 4 cellspacing = 4>
<tr bgcolor = #b3b3b3>
<td width = "20%" align="center">
</td>
<td width = "20%" align="center">
</td>
<td width = "20%" align="center">
</td>
<td width = "20%" align="center">
<a href="index.php">ENGLISH</a></td>
<td width = "20%" align="center">
<a href="index.php">FRENCH</a></td>
</table>
<hr size="1" noshade>
<p align="center"; class="small"> Copyright 2008 - Designed by <a
href="mailto:conmeobp@gmail.com"> ConMeoBP</a> - All Rights Reserved</p>
</body>
</html>
___________
6/ File "ind_styl.inc"
<body background="../img/bgd01.jpg">
<style>
<!-- P {font-size : small;} -->
P {font-size : 12.0pt;}
H1 {font-family : Verdana, Arial; text-align : center; color : red;}
H2 {font-family : Verdana, Arial; text-align : right; color : navy;}
H3 {font-family : Verdana, Arial; text-align : right; color : olive;}
H4 {font-family : Verdana, Arial; text-align : right; color : #302e52;}
H5 {font-family : Verdana, Arial; text-align : right; color : purple;}
H6 {font-family : Verdana, Arial; text-align : left; color : maroon;}
A {font-size : 10.0pt; font-family : Arial; color : #302e52; font-weight :
bold;}
<!-- A:Visited ==> Left_Frame & Right_Frame -->
A:Visited {font-size : 10.0pt; color : navy; font-weight : normal;}
A:Active color : #302e52;}
BODY {font-size : medium; font-family : Georgia, Times; color : #302e52;}
A.large {font-size : medium; color : #302e52; font-weight : normal;}
A:Visited.large {font-size : 10.0pt; color : red; font-weight : normal;}
A.Active.large {font-size : medium; color : #302e52; font-weight : normal;}
<!-- P.small ==> Foot_frame -->
P.small {color : maroon; font-size : x-small;}
</style>
</body>
__________
Nếu như các bạn muốn có đầy đủ hình được đề cập ở các files trên, và coi các scripts kia cho ra cái giống gì đây, trước khi copy vô
C:\APPSERV\WWW
bạn có thề vô đây lấy về
www.tiepsuc.org
ConMeoBP
TB - Bài viết trên dựa theo sách "PHP For Web Professionals - Christopher Cosentino - 2000". Nếu bạn nào cần photo sách này, tin tôi hay, tôi sẽ đem gởi sách này ở trụ sở DDTH số 205 Trần Bình Trọng Q5 - TP HCM, để các bạn mượn photo.
Bookmarks