Toton
Toton

Reputation: 138

How to set landing page in a codeigniter project setup?

I'm doing a project with codeigniter and I have a requirement to make a landing page from where user has option for entering the main site. I have already set the front controller for main site visit. Now how to make this front controller calling possible after the landing page?

$route['default_controller'] = 'front';

Upvotes: 1

Views: 2637

Answers (2)

Abdul Salam
Abdul Salam

Reputation: 406

You Just Create a new Controller name as Landing_page and you have to set this as your default controller $route['default_controller'] = 'Landing_page'; i think you were create the landing page is in codeigniter itself as a view page, if so u just load the view (landing) page in index() function of the same, otherwise you have to redirect the url to the subdomain as follows

Landing page as view:

Class Landing_page extends CI_Controller{

     function index(){

      $this->load->view('landing_page');

     }
}

As sub Domain:

Class Landing_page extends CI_Controller{

     function index(){

     redirect('http://landingPage.Your_website.com');

     }
}

Upvotes: 1

Ayyappa amara
Ayyappa amara

Reputation: 412

You need to create one controller in project_folder/application/controller/Front.php

Class Front extends CI_Controller{

     function index(){
          echo "Welcome to Front Page";
     }
}

All ready in route.php you have mentioned fonrt controller is default page.

Upvotes: 0

Related Questions