Postingan lainnya
Mau nampilin profile orang, tapi klo lagi aktiv di thumbnail ga k show with CI
Gan saya mau nampilin view profile orang per ID nya, tetapi ketika profile seseorang itu lagi active, di thumbnail orang dy ga bakal ke show. Tolong bantuanya gan.
Modelnya :
<?php if(!defined('BASEPATH')) exit('Hacking Attempt : Get Out of the system ..!');
class M_ourteam extends CI_Model {
public function __construct()
{
parent::__construct();
}
function tampil_data()
{
return $this->db->get('our_team');
}
function data_team()
{
return $this->db->get('our_team');
}
function tampil_news($where, $table)
{
$query = $this->db->get_where($table, $where);
return $query->result();
}
}//end class
Controllernya :
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Ourteams extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('m_ourteam');
$this->load->helper('form','url');
}
public function index()
{
$data['idx']= "";
$data['datateam'] = $this->m_ourteam->tampil_data()->result();
$this->load->view('ourteam', $data);
}
public function view($id)
{
$data['idx'] = $id;
$where = array('id' => $id);
$data['datateam'] = $this->m_ourteam->tampil_data()->result();
$data['datateam_item'] = $this->m_ourteam->tampil_news($where,'our_team');
$this->load->view('ourteam', $data);
}
}//end class
Viewnya :
<?php $this->load->view('template/tag1'); ?>
<body>
<!-- Header -->
<div class="container">
<?php $this->load->view('template/head'); ?>
</div>
<!-- Menu -->
<div class="wrap-nav">
<div class="container">
<?php $this->load->view('template/menu'); ?>
</div>
</div>
<br>
<!-- News -->
<div class="container">
<?php if($idx == ""){ ?>
<div class="row">
<?php foreach($datateam as $dteam){ ?>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url(); ?>assets/<?php echo $dteam->images;?>" class="img-responsive" alt="Responsive image" style="float:left; margin-right:10px;">
<div class="caption">
<h3 class="text-center lead"><?php echo $dteam->title;?></h3>
<p><?php echo substr($dteam->body, 0, 50) . "..."; ?> </p>
<p><a href="<?php echo base_url(); ?>ourteams/view/<?php echo $dteam->id;?>" class="btn btn-primary" role="button">View</a></p>
</div>
</div>
</div>
<?php } ?>
</div>
<?php }else{ ?>
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<?php foreach($datateam_item as $dteam_item) { ?>
<h2 class="text-center"> <?php echo $dteam_item->title; ?></h2>
<img src="<?php echo base_url(); ?>assets/<?php echo $dteam_item->images;?>" class="img-responsive" alt="Responsive image" style="width: 50%; margin-right:10px;">
<p><?php echo $dteam_item->body; ?></p>
<?php } ?>
</div>
</div>
<div class="row">
<?php foreach($datateam as $dteam){ ?>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="<?php echo base_url(); ?>assets/<?php echo $dteam->images;?>" class="img-responsive" alt="Responsive image" style="float:left; margin-right:10px;">
<div class="caption">
<h3 class="text-center lead"><?php echo $dteam->title;?></h3>
<p><?php echo substr($dteam->body, 0, 50) . "..."; ?> </p>
<p><a href="<?php echo base_url(); ?>ourteams/view/<?php echo $dteam->id;?>" class="btn btn-primary" role="button">View</a></p>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div> <!-- end container -->
<br>
<!-- Company Contact Us -->
<!--Footer-->
<?php
$this->load->view('template/footer');
?>
<!--END Footer-->
<!-- Separator Footer -->
<div class="container-fluid separator-footer">
</div>
<!-- Footer -->
<div class="container-fluid footer">
<div class="container">
<div class="col-sm-4" style="padding-top:10px;">
<p>Copyright © 2016 PolisMurah. All rights reserved.</p>
</div>
<div class="col-sm-4" style="padding-top:10px;">
<p><a href="#">Terms & Conditons</a> | <a href="#">Privacy Policy</a></p>
</div>
<div class="col-sm-4" style="padding-top:2px;">
<div align="right">
<p>Follow Us
<a href="#"><img src="<?php echo base_url(); ?>/style/images/index_47.png"></a>
<a href="#"><img src="<?php echo base_url(); ?>/style/images/index_48.png"></a>
<a href="#"><img src="<?php echo base_url(); ?>/style/images/index_49.png"></a>
<a href="#"><img src="<?php echo base_url(); ?>/style/images/index_50.png"></a>
</p>
</div>
</div>
</div>
</div>
<div style="margin-top:-40px;"></div>
<?php
$this->load->view('template/tag1');
?>
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban