saya punya kontroler yg ngeluarin seluruh data video, nah supaya di viewnya yg keluar terbagi 2 jenis kategori gimana saya masukin where conds / apa gitunya ya?
1. saya coba utak utik kok ndak berhasil, yg tampil tetep semua video jadi 1 div
2. saya utak utek lagi, eh malah yg keluar semua video jadi 2x tampilnya
huaaaaaaaaaa help help
ni controlernya:
class Video extends Controller {
function Video () {
parent::Controller();
$this->load->model('m_video');
$this->load->model('m_video_category');
}
function read ($id = '') {
if (!$category = $this->m_video_category->load($id)) {
if (isset($_SERVER['HTTP_REFERER'])) {
$host = str_replace($this->uri->uri_string(), '', $_SERVER['HTTP_REFERER']);
$params = str_replace($host, '', $_SERVER['HTTP_REFERER']);
$redirect = $params;
} else {
$redirect = '';
}
redirect($redirect);
return;
}
$this->load->library('flvplayer');
$this->load->library('pagination');
$this->load->config('pagination');
$params = $this->uri->uri_to_assoc(1);
$page_index = isset($params['page']) ? $params['page'] : 0;
$per_page = 10;
$page_url = '';
$base_url = site_url('video/index/' . $id . '/page/');
$offset = ($page_index == 0) ? '' : $page_index;
$where_conds = array('video_status' => 'publish');
$total_rows = count($this->m_video->find($where_conds));
$videos = $this->m_video->find($where_conds,
array('video_added' => 'DESC'),
$per_page,
$offset);
$config['base_url'] = $base_url;
$config['total_rows'] = $total_rows;
$config['uri_segment'] = $this->uri->total_segments();
$this->pagination->initialize($config);
$page_vars = array('videos' => $videos,
'page_url' => $page_url,
'page_index' => $page_index,
'params' => $params);
$this->load->vars($page_vars);
$this->load->view('main_header');
$this->load->view('main_left');
$this->load->view('video');
$this->load->view('main_right');
$this->load->view('main_footer');
}
}
?>
nah ini viewnya
if (isset($videos) ) {
$i = 0; foreach ($videos as $video) { if ($i== 0) {
} else if ($i % 2 == 0) {
} $video_player = $this->flvplayer->rendervideo($this->config->item('video_upload_url') . $video->file, $this->config->item('video_upload_url') . $video->thumb_file, 370, 270);
echo $video_player;
Artis
echo htmlentities($video->artist, ENT_QUOTES);
Judul
echo htmlentities($video->title, ENT_QUOTES);
View
echo htmlentities($video->hits, ENT_QUOTES);
Update
echo ($video->modified == '0000-00-00 00:00:00') ? substr($video->added, 0, 10) : substr($video->modified, 0, 10);
unset($video_player); $i++; }