	<?php
	if ($ctr_level >= 1)
	$sql = "select * from menus_level_0 as a ";
	
	if ($ctr_level >= '2')
	$sql .= ", menus_level_1 as b ";
	
	if ($ctr_level >= '3')
	$sql .= ", menus_level_2 as c ";
	
	$sql .= ", content as d WHERE ";
		
	if ($ctr_level >= 1)
	$sql .= "level_0 = a.id  ";
	if ($ctr_level == 1)
	$sql .= "AND menuLINK = '".$curPage1."' ";

	if ($ctr_level >= 2)
	$sql .= "AND a.id = b.menus_lv_0 AND b.id_level_1 = level_1 ";	
	if ($ctr_level == 2)		 
	$sql .= "AND link_lv_1 = '".$curPage1."' ";
	
	if ($ctr_level >= 3)
	$sql .= "AND b.id_level_1 = c.menus_lv_1 and level_2 = c.id_level_2 ";
	if ($ctr_level == 3)
	$sql .= "AND link_lv_2 = '".$curPage1."' ";

	if ($ctr_level > 3)
		$sql .= "AND targetPage = '".$curPage1."' ";

	$sql .= "ORDER by tanggal DESC ";
	
	//echo "<br> Sql : ".$sql;
	$preText = '';
	if ($hasil = mysql_query($sql)) {
		while ($data = mysql_fetch_array($hasil)) {
			if ($preText == '') {
				$preText = '
				<section class="M081 ">
					<div class="row">
						<div class="rowInner">
							<div class="col l-col8 m-col12 s-col12 modul-container">
								<span class="page-intro-topline">'.$data["namaMenu_lv_1"].'</span>
								<h1>'.$data["namaMenu_lv_2"].'</h1>
							</div>
						</div>
					</div>
				</section>';
			}
			$sql2 = "select * from content_trans, content_images where contentTrans_to_contentID = ".$data["idContent"]." and contentTransID = to_content_id order by contentImageID limit 0, 1";
			//echo "<br>".$sql2;
			if ($hasil2 = mysql_query($sql2)) {
				while ($data2 = mysql_fetch_array($hasil2)) {
					$imageContent = $data2["imageContent"];		
				}
			}
			$preText .= '
			<section class="M086 M0860201 module" data-modul="M0860201">
				<div class="row items">
					<div class="rowInner">
						<div class="col col l-col8 m-col12 s-col12 modul-container">
							<section class="news-body" itemscope="" itemtype="http://schema.org/NewsArticle">';
								if ($imageContent) {
									$preText .= '
									<a href="'.$thisPage.$data["targetPage"].'">
										<div class="news-image">
											<img alt="Gambar Berita" src="'.$thisPage.$data["targetPage"].'/images/'.$imageContent.'" />
										</div>
									</a>';
								}
								$preText .= '
								<a href="'.$thisPage.$data["targetPage"].'">
									<p itemprop="genre" class="news-category f-header">'.$data["title"].'</p>
									<h3 itemprop="headline">'.$data["pageTitle"].'</h3>
									<p class="news-text" itemprop="description">
										'.$data["short_description"].'
										<span class="news-link">more</span>
									</p>
								</a>
							</section>
						</div>
					</div>
				</div>
			</section>
			';
		}
		if ($preText != '') {
			echo $preText;
		}
	}
    ?>
