Menambah source halaman baru
- Administrator
- ,
- 2874 Kali Dilihat
- 2 Komentar
Pada themes website PopojiCms secara defauld memiliki halaman-halaman sebagai berikut: 404.php, album.php, category.php, contact.php, detailpost.php, footer.php, gallery.php, header.php, home.php, index.html, index.php, pages.php, preview.jpg, search.php, sidebar.php, dan tag.php .
Namun jika anda ingin memiliki halaman tambahan pada website yang sedang anda bangun menggunakan PopojiCms disamping halaman-halaman yang telah tersedia, misalnya anda ingin memiliki halaman home-jurnalis. Berikut adalah cara custom atau menambahkan source halaman baru:
1. Buatlah file baru pada po-content/themes/themesactive/home-jurnalis.php
(home-jurnalis.php adalah file contoh,silahkan anda buat sesuai keinginan).
Berikut contoh source untuk halaman baru(home-jurnalis.php):
<?=$this->layout('index');?>
<section id="content" class="light_section left-sidebar">
<div class="container">
<div class="row">
<!-- shortcodes -->
<div class="col-sm-8 col-md-8 col-lg-9">
<div class="flexslider">
<ul class="slides">
<?php
$sliders_post = $this->post()->getPost('6', 'DESC', WEB_LANG_ID);
foreach($sliders_post as $slider_post){
$slider_category = $this->category()->getCategory($slider_post['id_post'], WEB_LANG_ID);
?>
<li>
<div class="slide_description_wrapper right">
<div class="thumbnail">
<img src="<?=BASE_URL;?>/<?=DIR_CON;?>/uploads/<?=$slider_post['picture'];?>" alt="<?=$slider_post['title'];?>" style="height:500px;">
<div class="caption">
<div class="slide_description entry-content">
<h3 data-animation="fadeInLeft" style="fint-size:inherit; color:inherit;"><?=$slider_post['title'];?></h3>
<h3><a class="theme_button" href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $slider_post);?>"><?=$this->e($front_readmore);?></a></h3>
</div>
<p class="text-center team-social">
<a href="<?=BASE_URL;?>/<?=DIR_CON;?>/uploads/<?=$slider_post['picture'];?>" class="center-icon" data-gal="prettyPhoto" data-lightbox="image"><span class="teaser with_counter teaser_icon"><i class="rt-icon-eye"></i></span></a>
<a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $slider_post);?>" class="center-icon"><span class="teaser with_counter teaser_icon"><i class="rt-icon-link"></i></span></a>
</p>
</div>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
<?php
$about = $this->pocore()->call->podb->from('pages')
->select(array('pages_description.title', 'pages_description.content'))
->leftJoin('pages_description ON pages_description.id_pages = pages.id_pages')
->where('pages.id_pages', '33')
->where('pages_description.id_language', WEB_LANG_ID)
->where('pages.active', 'Y')
->limit(1)
->fetch();
?>
<h2 class="section_header text-center"><?=$this->e($about['title']);?></h2>
<?php $category_title = $this->category()->getOneCategory('7', WEB_LANG_ID); ?>
<div class="row">
<?php
$post_by_categorys = $this->post()->getPostByCategory('7', '2', 'DESC', WEB_LANG_ID);
foreach($post_by_categorys as $list_post){
?>
<div class="col-sm-4">
<div class="teaser with_image with_background">
<div class="teaser_image">
<a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>">
<img class="image_fade" src="<?=BASE_URL;?>/<?=DIR_CON;?>/uploads/medium/medium_<?=$list_post['picture'];?>" alt="">
</a>
</div>
<div class="teaser_description">
<h3><a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>"><?=$list_post['title'];?></a></h3>
<p><i class="fa fa-calendar"></i> <?=$this->pocore()->call->podatetime->tgl_indo($list_post['date']);?></p>
<p><a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>#comments"><i class="fa fa-comments"></i> <?=$this->post()->getCountComment($list_post['id_post']);?></a></p>
<a class="theme_button" href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>"><?=$this->e($front_readmore);?></a>
</div>
</div>
</div>
<?php } ?>
<div class="col-sm-4">
<div class="teaser with_image with_border">
<div class="teaser_description">
<h3><?=$this->e($front_breaking_news);?></h3>
<?php
$headlines = $this->post()->getHeadline('5', 'DESC', WEB_LANG_ID);
foreach($headlines as $headline){
?>
<ul class="list1 text-left">
<li><a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $headline);?>">
<strong><?=$headline['title'];?></strong></a></li>
</ul>
<?php } ?>
</div>
</div>
</div>
</div>
<hr class="divider40">
<h2 class="text-center divider40"><?=$category_title['title'];?></h2>
<div class="row">
<?php
$post_by_categorys = $this->post()->getPostByCategory('7', '6', 'DESC', WEB_LANG_ID);
foreach($post_by_categorys as $list_post){
?>
<div class="col-sm-6">
<div class="side_teaser media with_background">
<a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>">
<img class="image_fade" src="<?=BASE_URL;?>/<?=DIR_CON;?>/uploads/medium/medium_<?=$list_post['picture'];?>" alt="">
</a>
<div class="media-body">
<h3 class="media-heading"><a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>"><?=$list_post['title'];?></a></h3>
<p><?=$this->pocore()->call->postring->cuthighlight('post', $list_post['content'], '200');?> ...</p>
<a class="theme_button" href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>"><?=$this->e($front_readmore);?></a>
</div>
</div>
<hr class="divider40">
</div>
<?php } ?>
</div>
<hr class="divider40">
<div class="row">
<div class="col-sm-12">
<div id="partners-carousel" class="owl-carousel">
<?php
$sliders_post = $this->post()->getPost('6', 'DESC', WEB_LANG_ID);
foreach($sliders_post as $slider_post){
$slider_category = $this->category()->getCategory($slider_post['id_post'], WEB_LANG_ID);
?>
<div>
<div>
<a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $slider_post);?>">
<img src="<?=BASE_URL;?>/<?=DIR_CON;?>/uploads/<?=$slider_post['picture'];?>" height="200px" width="90%" alt="<?=$slider_post['title'];?>">
</a>
<h2 class="text-center divider40"><a href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $list_post);?>"><?=$slider_post['title'];?></a></h2>
<a class="theme_button" href="<?=$this->pocore()->call->postring->permalink(rtrim(BASE_URL, '/'), $slider_post);?>"> <?=$this->e($front_readmore);?> </a>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<hr class="divider40">
</div>
</div>
</div>
</section>
<section class="color_section table_section action_section">
<div class="container">
<div class="row">
<div class="col-sm-8">
<?php
$about = $this->pocore()->call->podb->from('pages')
->select(array('pages_description.title', 'pages_description.content'))
->leftJoin('pages_description ON pages_description.id_pages = pages.id_pages')
->where('pages.id_pages', '21')
->where('pages_description.id_language', WEB_LANG_ID)
->where('pages.active', 'Y')
->limit(1)
->fetch();
?>
<h2><?=$this->e($about['title']);?>?</h2>
<p><?=htmlspecialchars_decode(html_entity_decode($this->e($about['content'])));?></p>
</div>
<div class="col-sm-4">
<a href="<?=BASE_URL;?>/contact" class="theme_button block_button"><i class="fa fa-phone"></i> <?=$this->e($front_contact);?>!</a>
</div>
</div>
</div>
</section>
Buat script sesuai yang anda inginkan dalam file home-jurnalis.php tersebut.
2. Silahkan buka po-content/component/home/home.php
Tempel script/code dibawah ini pada baris paling bawah(dibawah semua code yang ada disana).
/*
*
* Sesuaikan kode dibawah, ganti "demojurnalis" yang terdapat di 5-baris,dengan halaman yang anda buat.
* Kemudian tempelkan pada po-content/component/home/home.php (pada baris paling akhir)
*
*/
$router->match('GET|POST', '/demojurnalis', function() use ($core, $templates) {
$lang = $core->setlang('home', WEB_LANG);
$info = array(
'page_title' => 'Demojurnalis',
'page_desc' => $core->posetting[2]['value'],
'page_key' => $core->posetting[3]['value'],
'social_mod' => 'Demojurnalis',
'social_name' => $core->posetting[0]['value'],
'social_url' => $core->posetting[1]['value'].'/demojurnalis',
'social_title' => $core->posetting[0]['value'],
'social_desc' => $core->posetting[2]['value'],
'social_img' => $core->posetting[1]['value'].'/'.DIR_INC.'/images/favicon.png',
'page' => '1'
);
$adddata = array_merge($info, $lang);
$templates->addData(
$adddata
);
echo $templates->render('demojurnalis', compact('lang'));
});
3. Silahkan coba kunjungi https://namadomain.com/home-jurnalis melalui browser yang anda gunakan.
Sebagai contoh silahkan lihat dan sorot menggunakan mouse anda menu diatas pada menu "Beranda".
edison