[eluser]HSKrustofsky[/eluser]
Im in dire need of some assistance. I have been looking around and came up with something I though would work, but nope, blank screen. Any ideas?
Controller:
Code:
<?php
class Admin extends Controller {
function Admin() {
parent::Controller();
}
function index() {
$data = array();
if($query = $this->admin_model->retrieve()) {
$data['records'] = $query;
}
$data['title'] = "Admin";
$this->load->view('panelview', $data);
}
function create() {
if ($_POST) {
$save = array(
'title' => $this->input->post('title'),
'contents' => $this->input->post('contents'),
$config = array (
'upload_path' => 'uploads',
'allowed_types'=> 'gif|jpg|jpeg|png',
'max_size' => '5120';
'overwrite' => FALSE
);
$this->load->library('upload', $config);
if ($this->upload->do_upload('userfile')) {
$data = $this->upload->data();
}
$file_name = !empty($data['upload_data']) ? $data['upload_data']['file_name'] : NULL ;
);
$this->admin_model->create($save, $config);
}
$data['title'] = "Add News";
$this->load->view('addnews', $data);
if($_POST != NULL) {
redirect('../admin/');
}
}
function delete() {
$this->admin_model->delete();
$this->index();
}
function update($id) {
if ($_POST) {
$save = array(
'title' => $this->input->post('title'),
'contents' => $this->input->post('contents'),
);
$this->admin_model->update($save, $id);
}
$data['news'] = $this->admin_model->get($id);
$data['title'] = "Update";
$this->load->view('editnews', $data);
if($_POST != NULL) {
redirect('../admin/');
}
}
}
Don't know if or what I need in the model and/or views. Any assistance would be awesome!