<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Movies_genre extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Model_common');
$this->load->model('Model_movie_genre');
//$this->load->model('Model_portfolio');
}
public function index($genre_type=NULL)
{
/*if( !isset($id) || !is_numeric($id) ) {
redirect(base_url());
}*/
$tot = $this->Model_movie_genre->genre_check($genre_type);
if(!$tot) {
redirect(base_url());
}
$data['general_settings'] = $this->Model_common->general_settings();
$data['page_movies_genre'] = $this->Model_common->page_movies_genre();
$data['social_settings'] = $this->Model_common->social_settings();
$data['movies_by_genre'] = $this->Model_movie_genre->movies_by_genre($genre_type);
$data['genre_by_name'] = $this->Model_movie_genre->genre_by_name($genre_type);
//$data['portfolio_footer'] = $this->Model_portfolio->get_portfolio_data();
$this->load->library('pagination');
$config = array();
$config['full_tag_open'] = '<div class="pagging text-center"><nav><ul class="pagination">';
$config['full_tag_close'] = '</ul></nav></div>';
$config['num_tag_open'] = '<li class="page-item"><span class="page-link">';
$config['num_tag_close'] = '</span></li>';
$config['cur_tag_open'] = '<li class="page-item active"><span class="page-link">';
$config['cur_tag_close'] = '<span class="sr-only">(current)</span></span></li>';
$config['next_tag_open'] = '<li class="page-item"><span class="page-link">';
$config['next_tag_close'] = '<span aria-hidden="true"></span></span></li>';
$config['prev_tag_open'] = '<li class="page-item"><span class="page-link">';
$config['prev_tag_close'] = '</span></li>';
$config['first_tag_open'] = '<li class="page-item"><span class="page-link">';
$config['first_tag_close'] = '</span></li>';
$config['last_tag_open'] = '<li class="page-item"><span class="page-link">';
$config['last_tag_close'] = '</span></li>';
$config["base_url"] = base_url() . "movies/genre";
$config["total_rows"] = $this->Model_movie_genre->movies_by_genre($genre_type);
$config['first_url'] = base_url() . 'movies/genre';
$config["per_page"] = 18;
$config["uri_segment"] = 3;
$config['use_page_numbers'] = TRUE;
//$config['page_query_string'] = TRUE;
$this->pagination->initialize($config);
$offset = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data['movies_fetched'] = $this->Model_movie_genre->movies_by_genre($genre_type, $config["per_page"], $offset);
$data["links"] = $this->pagination->create_links();
$this->load->view('view_header',$data);
$this->load->view('view_movies_genre',$data);
$this->load->view('view_footer',$data);
}
}