<?php
function contenthome($idc, $langc) {
		if ($langc=="en"){
			$table = new PoTable('post');
			$current = $table->findByDESC(id_category, $idc, id_post);
			$current = $current->current();
			$id = $current->id_post;
			$title = $current->title_en;
			$seotitle = $current->seotitle_en;
			$content = $current->content_en;
			$content = strip_tags($content);
            $content = substr($content,0,200);
            $content = substr($content,0,strrpos($content," "));
			$content = html_entity_decode($content);
			$picture = $current->picture;
			$editor = $current->editor;
			$tgl = $current->date;
			$tanggal = substr($tgl,8,2);
			$bulan = getBulanEn(substr($tgl,5,2));
			$tahun = substr($tgl,0,4);
			$valid = $current->id_category;
			$tablecat = new PoTable('category');
			$currentCat = $tablecat->findBy(id_category, $valid);
			$currentCat = $currentCat->current();
			$tcat = $currentCat->title_en;
			$cat = $currentCat->seotitle_en;
			$comments = "comments";
			$by = "By";
			$outputhome = array(
				'id' => $id,
				'title' => $title,
				'seotitle' => $seotitle,
				'content' => $content,
				'picture' => $picture,
				'editor' => $editor,
				'tanggal' => $tanggal,
				'bulan' => $bulan,
				'tahun' => $tahun,
				'tcat' => $tcat,
				'cat' => $cat,
				'comment' => $comments,
				'by' => $by
			);
			return $outputhome;
		}else{
			$table = new PoTable('post');
			$current = $table->findByDESC(id_category, $idc, id_post);
			$current = $current->current();
			$id = $current->id_post;
			$title = $current->title_id;
			$seotitle = $current->seotitle_id;
			$content = $current->content_id;
			$content = strip_tags($content);
            $content = substr($content,0,200);
            $content = substr($content,0,strrpos($content," "));
			$content = html_entity_decode($content);
			$picture = $current->picture;
			$editor = $current->editor;
			$tgl = $current->date;
			$tanggal = substr($tgl,8,2);
			$bulan = getBulanId(substr($tgl,5,2));
			$tahun = substr($tgl,0,4);
			$valid = $current->id_category;
			$tablecat = new PoTable('category');
			$currentCat = $tablecat->findBy(id_category, $valid);
			$currentCat = $currentCat->current();
			$tcat = $currentCat->title_id;
			$cat = $currentCat->seotitle_id;
			$comments = "komentar";
			$by = "Oleh";
			$outputhome = array(
				'id' => $id,
				'title' => $title,
				'seotitle' => $seotitle,
				'content' => $content,
				'picture' => $picture,
				'editor' => $editor,
				'tanggal' => $tanggal,
				'bulan' => $bulan,
				'tahun' => $tahun,
				'tcat' => $tcat,
				'cat' => $cat,
				'comment' => $comments,
				'by' => $by
			);
			return $outputhome;
		}
}
?>