01.
<?php
02.
function
ttruncat(
$text
,
$numb
) {
03.
if
(
strlen
(
$text
) >
$numb
) {
04.
$text
=
substr
(
$text
, 0,
$numb
);
05.
06.
$etc
=
" ..."
;
07.
$text
=
$text
.
$etc
;
08.
}
09.
return
$text
;
10.
}
11.
12.
?>
13.
<div id=
'news'
>
14.
15.
</div>
16.
<!-- Page Content -->
17.
<div
class
=
"container "
>
18.
<!-- Marketing Icons Section -->
19.
<div
class
=
"row"
>
20.
<div
class
=
"main_featured m-top-100"
>
21.
<div
class
=
"col-lg-12"
>
22.
<div
class
=
"head_title text-center"
>
23.
<h2>News&Events</h2>
24.
<div
class
=
"separator_auto"
></div>
25.
<br>
26.
</div>
27.
</div>
28.
</div>
29.
<?php
30.
while
(
$result
=mysqli_fetch_array(
$query
,MYSQLI_ASSOC))
31.
{
32.
$txtMessage
=
$result
[
"txtMessage"
];
33.
?>
34.
<div
class
=
"col-md-4 thaifont"
style=
"color:#000000;"
>
35.
<div
class
=
"portfolio-item"
>
36.
<img
class
=
"img-responsive"
src=
"login/images/<?php echo $result["
img
"]?>"
width=
"750"
height=
"450"
>
37.
<h3 style=
"color:#000000;"
><?php
echo
$result
[
"title"
] ?></h3>
38.
</div>
39.
40.
<p >
41.
<?php
echo
ttruncat(
$txtMessage
,600)?> </p>
42.
<?php
43.
if
(
$result
[
"a_id"
] ==
"1"
) {
44.
?>
45.
<a href=
"readmore1.php"
class
=
"btn btn-info "
style=
"color:#fff;"
>ReadMore</a>
46.
47.
<?php
48.
49.
}
elseif
(
$result
[
"a_id"
] ==
"2"
) {
50.
?>
51.
<a href=
"readmore2.php"
class
=
"btn btn-info"
style=
"color:#fff;"
>ReadMore</a>
52.
53.
<?php
54.
55.
}
56.
elseif
(
$result
[
"a_id"
] ==
"3"
) {
57.
?>
58.
<a href=
"readmore3.php"
class
=
"btn btn-info"
style=
"color:#fff;"
>ReadMore</a>
59.
60.
<?php
61.
62.
}
63.
?>
64.
</div>
65.
<?php
66.
}
67.
?>
68.
69.
<?php
70.
mysqli_close(
$conn
);
71.
?>
72.
</div>
73.
<!-- /.row -->
74.
</div>