Codeigniter controllers subfolders
Codeigniter controllers subfolders: You can organize your controller file in subfolders.
Codeigniter controllers subfolders Example
First create a folder name as “admin” inside controllers ie . “application/controllers/admin”.
Suppose we are developing the admin module in our project and we want to keep separate it from the front end files.
Now we will add each controllers in admin folder which will belong to admin module.
We have created a controller named as “login” inside the folder “application/controllers/admin/”
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Login extends CI_Controller { public function index() { $this->load->view('login_view'); } }
Now for Accessing the login view you have to access the url “http://localhost/admin/login” which will load the login page of the admin module.
Advertisements
Add Comment
đź“– Read More
- 1. Codeigniter Autoload Models
- 2. Codeigniter Connect Database
- 3. Codeigniter Helpers Example
- 4. Codeigniter Load Helper
- 5. Codeigniter libraries
- 6. Array Helper
- 7. CAPTCHA Helper
- 8. Cookie Helper
- 9. Date Helper
- 10. Directory Helper