Url Structure (http://localhost/cig/index.php/Controller/function)
Lets create New Controller UnderConstruction and view under_construction
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class UnderConstruction extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/underconstruction
* - or -
* http://example.com/index.php/underconstruction/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/underconstruction/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('under_construction');
}
public function test() {
echo "Works Well";
}
}
It will show 404 error - if index () function is missing
http://localhost/cig/index.php/underconstruction/test - Open this Url
http://localhost/cig/index.php/underconstruction/test - Open this Url
It will provoke the specific function inside the controller
In View Section just copy paste welcome_message and little edit it.
In View Section just copy paste welcome_message and little edit it.
$this->load->view('blob/under_construction');
If our view under_construction is located in view->blog-> then we must have to mention blog, as by default all views are fetched from root folder.
No comments:
Post a Comment