Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / www / html / sman1baleendahok / modul / | server ip : 104.21.89.46 your ip : 172.69.130.131 H O M E |
Filename | /var/www/html/sman1baleendahok/modul/tag_berita3.php |
Size | 1.56 kb |
Permission | rw-rw-r-- |
Owner | ulung : ulung |
Create time | 27-Apr-2025 11:12 |
Last modified | 05-Feb-2025 08:55 |
Last accessed | 06-Jul-2025 15:59 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
$n=0;
$sql="select * from t_news order by id desc limit 0,8";
if(!$query=mysql_query($sql)) die ("Pengambilan gagal1 berita $id");
while ($row=mysql_fetch_array($query)) {
$isi = strip_tags($row[isi]);
$max = 300; // maximal 300 karakter
$min = 200; // minimal 150 karakter
if( strlen( $isi ) > $max ) {
$pecah = substr( $isi, 0, $max );
$akhirParagrap = strrpos( $pecah, "\n" );
$akhirKalimat = strrpos( $pecah, '.' );
$akhirSubKalimat = strrpos( $pecah, ',' );
$spasiTerakhir = strrpos( $pecah, ' ' );
if( $akhirParagrap >= $min ) {
$potong = $akhirParagrap;
}elseif( $akhirKalimat >= $min ) {
$potong = $akhirKalimat;
}elseif( $akhirSubKalimat >= $min ) {
$potong = $akhirSubKalimat;
}else {
$potong = $spasiTerakhir;
}
$isi = substr( $isi, 0, $potong+1 )."...";
}
$file = "../images/berita/gb$row[id].jpg";
$gb="";
if (file_exists(''.$file.'')) {
$gb='<img src="'.$file.'" width=100 height=75 border=1 align=left hspace=5 id=gambar >';
}
if ($n<3) {
$tag .="$gb<div class='ari12'><b><a href='index.php?id=berita&kode=$row[id]' >$row[subject]</a></b></div><p>
$isi</p><hr color='#D3D3D3' >";
$n++;
}
else {
if ($n==3) $tag.="<ul>";
elseif ($n==8) $tag.="</ul>";
$judul = substr($row[subject], 0, 40);
$isib = substr($row[subject],40,50);
$isib = strtok($isib," ");
$judul .= $isib."...";
$judul = stripslashes($judul);
$tag .="<li> <a href='index.php?id=berita&kode=$row[id]' >
$judul</a></li>";
$n++;
}
}
$tag.="</ul>";
?>
$n=0;
$sql="select * from t_news order by id desc limit 0,8";
if(!$query=mysql_query($sql)) die ("Pengambilan gagal1 berita $id");
while ($row=mysql_fetch_array($query)) {
$isi = strip_tags($row[isi]);
$max = 300; // maximal 300 karakter
$min = 200; // minimal 150 karakter
if( strlen( $isi ) > $max ) {
$pecah = substr( $isi, 0, $max );
$akhirParagrap = strrpos( $pecah, "\n" );
$akhirKalimat = strrpos( $pecah, '.' );
$akhirSubKalimat = strrpos( $pecah, ',' );
$spasiTerakhir = strrpos( $pecah, ' ' );
if( $akhirParagrap >= $min ) {
$potong = $akhirParagrap;
}elseif( $akhirKalimat >= $min ) {
$potong = $akhirKalimat;
}elseif( $akhirSubKalimat >= $min ) {
$potong = $akhirSubKalimat;
}else {
$potong = $spasiTerakhir;
}
$isi = substr( $isi, 0, $potong+1 )."...";
}
$file = "../images/berita/gb$row[id].jpg";
$gb="";
if (file_exists(''.$file.'')) {
$gb='<img src="'.$file.'" width=100 height=75 border=1 align=left hspace=5 id=gambar >';
}
if ($n<3) {
$tag .="$gb<div class='ari12'><b><a href='index.php?id=berita&kode=$row[id]' >$row[subject]</a></b></div><p>
$isi</p><hr color='#D3D3D3' >";
$n++;
}
else {
if ($n==3) $tag.="<ul>";
elseif ($n==8) $tag.="</ul>";
$judul = substr($row[subject], 0, 40);
$isib = substr($row[subject],40,50);
$isib = strtok($isib," ");
$judul .= $isib."...";
$judul = stripslashes($judul);
$tag .="<li> <a href='index.php?id=berita&kode=$row[id]' >
$judul</a></li>";
$n++;
}
}
$tag.="</ul>";
?>