[eluser]bretticus[/eluser]
[quote author="garycocs" date="1249516903"]Sorry could you explain this another bit?? Not getting that last post
[/quote]
Code:
function index()
{
$data['title'] = "Karaoke on YouTube - All your karaoke needs in one place!";
$data['base'] = $this->config->item('base_url');
$data['css'] = $this->config->item('css');
$data['queryheaderlist'] = $this->home_model->get_header_list();
$data['videolist'] = $this->home_model->get_video_list('10','0','0');
$data['formtypearray'] = $this->home_model->form_type();
$data['formagearray'] = $this->home_model->form_age();
$this->load->view('home_view',$data);
}
function addvideo()
{
$rules['name'] = "required";
$rules['link'] = "required";
$rules['artist'] = "required";
$rules['type'] = "required";
$rules['age'] = "required";
$this->validation->set_rules($rules);
if($this->validation->run() == FALSE) {
$data['title'] = "Karaoke on YouTube - All your karaoke needs in one place!";
$data['base'] = $this->config->item('base_url');
$data['css'] = $this->config->item('css');
$data['queryheaderlist'] = $this->home_model->get_header_list();
$data['videolist'] = $this->home_model->get_video_list('10','0','0');
$data['formtypearray'] = $this->home_model->form_type();
$data['formagearray'] = $this->home_model->form_age();
$this->load->view('addvideo_view',$data);
} else {
$link = $_POST['link'];
$linkarray = explode("=", $link);
$link=$linkarray[1];
$linkarray = explode("&", $link);
$link=$linkarray[0];
$data = array(
'name' => $_POST['name'],
'link' => $link,
'artist' => $_POST['artist'],
'type' => $_POST['type'],
'age' => $_POST['age']
);
$this->db->insert('videos', $data);
$id = $this->db->insert_id();
redirect('controller/viewvideo/' . $id);
}
}
function viewvideo()
{
$data['title'] = "Karaoke on YouTube - All your karaoke needs in one place!";
$data['base'] = $this->config->item('base_url');
$data['css'] = $this->config->item('css');
$data['queryheaderlist'] = $this->home_model->get_header_list();
$data['videolist'] = $this->home_model->get_video_list('1','0',$this->uri->segment(3));
$data['formtypearray'] = $this->home_model->form_type();
$data['formagearray'] = $this->home_model->form_age();
$this->load->view('video_view',$data);
}