Skip to content

Instantly share code, notes, and snippets.

@hSammir
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save hSammir/8e0ae188514a90a5527c to your computer and use it in GitHub Desktop.

Select an option

Save hSammir/8e0ae188514a90a5527c to your computer and use it in GitHub Desktop.
Menampilkan daftar berita plus gambar *hanya* untuk list berita ter atas.
<?php
/*
Asumsikan database:
| Judul Berita | Kutipan berita | Gambar |
*/
$data = [
[
'jb' => 'Workshop Pengenalan Drupal',
'kb' => 'Workshop \"Mengenal Drupal\" yang dilaksanakan oleh UKM IT \"Cybernetix\" ',
'gb' => 'http://cybernetix.or.id/sites/default/files/styles/konten/public/workshop-drupal1_0.jpg'
],
[
'jb' => 'Musyawarah Besar VI',
'kb' => 'Musyawarah Besar UKM IT Cybernetix VI ',
'gb' => 'http://cybernetix.or.id/sites/default/files/styles/block_kegiatan/public/mubes.jpg'
],
[
'jb' => 'Latihan Dasar Kepemimpinan Mahasiswa I',
'kb' => 'Pelatihan dasar tentang segala hal yang berkaitan dengan kepemimpinan',
'gb' => 'http://cybernetix.or.id/sites/default/files/styles/block_kegiatan/public/ldkm-1.jpg?itok=uAWeAXGr'
]
];
$i = -1;
foreach ($data as $datum) {
$i++;
if($i==0){
echo "<img src='".$datum['gb']."'<br/>".$datum['jb']."<br/><hr>";
}else{
echo "$datum[jb]<br/><hr>";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment