<?php
if(count(get_included_files()) ==1) exit("Direct access not permitted.");
$mod = basename(__FILE__, '.php');
$page->tbCss($mod);
$query="select t1.tautan,t1.idgambar,t1.judul,
		if(t2.nama_awal is null,'PILIH FILE UNTUK UPLOAD BANNER BERITA',t2.nama_awal) as nama_awal,
		if(t2.nama_baru is null,'',t2.nama_baru) as nama_baru,
		if(t2.folder is null,'',t2.folder) as folder 
		from tb_linkterkait as t1
	left join tb_dokumen as t2 on t1.idgambar=t2.id
	where t1.status=1 and jenis=1 order by t1.urutan asc";
$rsiklan=$db->loadAll($query);
?>
<div class="box_linkterkait">
	<div class="kertas">LINK TERKAIT</div>
	<div class="box_linkterkait_main" align="center">
	<?php
	if(sizeof($rsiklan)>0){
		for($n=0;$n<sizeof($rsiklan);$n++){
			
			?>
			<div class="box_linkterkait_isi">
				<?php
				$srcgambar=NPAGE.$rsiklan[$n]['folder'].$rsiklan[$n]['nama_baru'];
				if($rsiklan[$n]['idgambar']>0){
					?>
					<a target="_blank" href="<?php echo $rsiklan[$n]['tautan'];?>">
						<div class="box_gambar_linkterkait">
							<img src="<?php echo $srcgambar;?>" />
						</div>
					</a>
					<?php
				}
				?>
				<div style="clear: both;"></div>
			</div>
			<?php
		}
	}
	?>
	</div>
	<div style="clear: both;"></div>
</div>