[eluser]shinokada[/eluser]
I have the following controller.
Code:
class Categories extends Controller {
function Categories(){
parent::Controller();
session_start();
if (!isset($_SESSION['userid']) || $_SESSION['userid'] < 1){
redirect('welcome/verify','refresh');
}
}
function index(){
$data['title'] = "Manage Categories";
$data['main'] = 'admin_cat_home';
$data['categories'] = $this->MCats->getAllCategories();
$this->load->vars($data);
$this->load->view('dashboard');
}
function create(){
if ($this->input->post('name')){
$this->MCats->addCategory();
$this->session->set_flashdata('message','Category created');
redirect('admin/categories/index','refresh');
}else{
$data['title'] = "Create Category";
$data['main'] = 'admin_cat_create';
$data['categories'] = $this->MCats->getTopCategories();
$data['right'] = 'category_right';
$this->load->vars($data);
$this->load->view('dashboard');
}
}
...
...
When I create a new category, I want to add to create a directory with the name of input
IF it does not exist in the image directory.
I guess I need to use the Directory helper and mkdir() with IF statement.
Can anyone direct me how to do it please?