LAB – NHÓM TIN T C THEO CHI U D C + M trang default.php
+ t con tr t i v trí c n xu t các tin t c nhóm theo chi u d c th lo i
in
+ Click nút Nested Repeat Region Wizard
+ C a s Nested Repeat Region Wizard xu t hi n
VI
YÊN
Trang 2+ Click nút Next
+ Ch n ki u l p l i t i Repeat style
+ Click nút Finish
+ Vào File -> Save -> F12
+ K t qu s nh sau
VI
YÊN
Trang 3+ Sau đó hãy đóng trang web đang xem l i
VI
YÊN
Trang 4+ Ch n {detail2tintuc.tieudetin} sau đó chuy n sang ch đ Code b n s th y có đo n code g c
nh sau:
<table border=1>
<?php do { ?>
<tr>
<td><b><?php echo $row_master1theloaitin['tentheloaitin']; ?></b></td>
</tr>
<?php
if ($totalRows_master1theloaitin>0) {
$nested_query_detail2tintuc = str_replace("123456789", $row_master1theloaitin['ID_theloaitin'],
$query_detail2tintuc);
mysql_select_db($database_conn_petrolimex);
$detail2tintuc = mysql_query($nested_query_detail2tintuc, $conn_petrolimex) or die(mysql_error()); $row_detail2tintuc = mysql_fetch_assoc($detail2tintuc);
$totalRows_detail2tintuc = mysql_num_rows($detail2tintuc);
$nested_sw = false;
if (isset($row_detail2tintuc) && is_array($row_detail2tintuc)) {
do { //Nested repeat
?>
<tr>
<td> <?php echo $row_detail2tintuc['tieudetin']; ?></td>
</tr>
<?php
} while ($row_detail2tintuc = mysql_fetch_assoc($detail2tintuc)); //Nested move next
}
}
?>
<?php } while ($row_master1theloaitin = mysql_fetch_assoc($master1theloaitin)); ?>
</table>
B n hãy thêm vào m t s đo n code n a nh sau:
if (isset($row_detail2tintuc) && is_array($row_detail2tintuc)) {
$dem=0;
do { //Nested repeat
$dem++;
if($dem==1)
{
VI
YÊN
Trang 5?>
<tr>
<td>chen hinh vao day <?php echo $row_detail2tintuc['tieudetin']; ?></td>
</tr>
<?php
}
else
{
?>
<tr>
<td> <?php echo $row_detail2tintuc['tieudetin']; ?></td>
</tr>
<?php
} //ket thuc else
} while ($row_detail2tintuc = mysql_fetch_assoc($detail2tintuc)); //Nested move next
}
}
?>
<?php } while ($row_master1theloaitin = mysql_fetch_assoc($master1theloaitin)); ?>
+ File -> Save -> F12 b n s th y nh sau
VI
YÊN
Trang 6+ Hãy chuy n sang ch đ Design sau đó ch n ch chen hinh vao day
+ Hãy xóa ch này đi sau đó vào Panel Aplication -> click + -> Developer Toolbox -> File Upload -> Show Thumbnail
+ Hãy ch n th m c đang ch a các hình Thumbnail t i File Folder
VI
YÊN
Trang 7+ Hãy ch n Recordset detail2tintuc
+ Ch n filed hinhtrichdan
+ Ch n ph ng pháp Resize hình nh t i Resize method
+ nh đ r ng và chi u cao cho nh t i Width & Height
+ Click nút OK
VI
YÊN
Trang 8+ Sau đó hãy ch n hình và trong h p thu c tính c a hình hãy ch n Align là Left và g n class
canhleimage cho hình này
+ Hãy đ t con tr sau {detail2tintuc.tieudetin} , nh n Shift + Enter
VI
YÊN
Trang 9+ Sau đó hãy chèn trichdantin vào
+ File -> Save -> F12 đ có k t qu nh hình bên d i
VI
YÊN
Trang 10o n code PHP tham kh o nh sau:
<table border=1>
<?php do { ?>
<tr>
<td><b><?php echo $row_master1theloaitin['tentheloaitin']; ?></b></td>
</tr>
<?php
if ($totalRows_master1theloaitin>0) {
$nested_query_detail2tintuc = str_replace("123456789", $row_master1theloaitin['ID_theloaitin'],
$query_detail2tintuc);
mysql_select_db($database_conn_petrolimex);
VI
YÊN
Trang 11$detail2tintuc = mysql_query($nested_query_detail2tintuc, $conn_petrolimex) or die(mysql_error()); $row_detail2tintuc = mysql_fetch_assoc($detail2tintuc);
$totalRows_detail2tintuc = mysql_num_rows($detail2tintuc);
$nested_sw = false;
if (isset($row_detail2tintuc) && is_array($row_detail2tintuc)) {
$dem=0; //doan code them vao
do { //Nested repeat
$dem++; //doan code them vao
if($dem==1) //doan code them vao
{ //doan code them vao
// doan code them vao ben duoi
?> //doan code them vao
<tr>
<td><img src="<?php echo $objDynamicThumb1->Execute(); ?>" hspace="10" border="0" align="left" /><?php echo $row_detail2tintuc['tieudetin']; ?><br />
<?php echo $row_detail2tintuc['trichdannoidung']; ?></td>
</tr>
<?php
}
else // them vao dk nguoc lai chi xuat ra tieu de
{ //ket thuc doan code doan code them vao ben duoi
?>
<tr>
<td> <?php echo $row_detail2tintuc['tieudetin']; ?></td>
</tr>
<?php
} // ket thuc else them vao
} while ($row_detail2tintuc = mysql_fetch_assoc($detail2tintuc)); //Nested move next
}
}
?>
<?php } while ($row_master1theloaitin = mysql_fetch_assoc($master1theloaitin)); ?>
</table>
+ Double click vào Recordset (detail2tintuc)
VI
YÊN
Trang 12+ Hãy ch n s p x p theo ngaydangtin gi m d n
+ Click nút Advanced đ chuy n sang ch đ Recordset nâng cao
VI
YÊN
Trang 13+ Hãy thêm l nh Limit 0,4 vào đ gi i h n s m u tin xu t ra
+ Click OK
+ File -> Save -> F12 đ có đ c k t qu nh hình bên d i
VI
YÊN
Trang 14YÊN