// Controller method for creating a new post
public function create() {
if ($this->input->post()) {
$data = array(
'title' => $this->input->post('title'),
'content' => $this->input->post('content'),
'author' => $this->input->post('author'),
'date_published' => date('Y-m-d H:i:s')
);
$this->load->model('Blog_model');
$this->Blog_model->create_post($data);
// Redirect to the blog post listing page
redirect('blog');
} else {
// Display the create post form
$this->load->view('blog/create');
}
}