Blog of King Software

Learn online with us in simple steps.

HOW TO SETUP HTML TEMPLATE IN CODEIGNITER?


Created by Bhavesh Gohil & Vicky Parekh on Date: 27/02/2021
STEPS TO SETUP HTML TEMPLATE IN CODEIGNITER

Step 1:   Create a new folder:

  • Create a new folder for your project and paste the Codeigniter files in this project folder

  • SEO & DIGITAL MARKETING IN BARKING, Essex , London.-Kingsoftware

Step 2:   Make source folder:

  • Create a new folder as source folder in the Codeigniter folder.

  • Copy and paste original template in this source folder.

Step 3:   Setup of config file:

  • Go to application/config folder and open config.php file.
  • Then go to line no.26 which shows $config['base_url'].
  • Set the path of your folder in this variable as shown in the image and save the file.


Step 4:   Setup of routes file:

  • Go to application/config folder and open routes.php file.
  • Then go to line no.52 which shows $route['default_controller'].
  • By default the controller is already set with the Welcome controller.



  • Change the controller name with the one that you want to create.


Step 5:   Setup of database file:

  • Go to application/config folder and open database.php file.
  • You can see the Codeigniter database file as below:



  • You can change username, password and database details that you created for the project in this file as shown below:


Step 6:   Make an assets folder:

  • Make a new folder in Codeigniter folder and named it as an assets folder.



  • Go to source folder that you created earlier and copy the css, js, images, fonts files.


  • Then paste the files in the assets folder as shown in the image below:

Step 7:   Make a common folder:

  • Make a new folder in application/views/ folder. Name this folder as common


  • In this common folder, create files that are common in all the webpages of your website like head, header, footer, script.


  • In head.php file, add the the head tag code like title, description, style sheets to be called, etc.



  • In header.php file, add the header tag code like menu, categories, search, social, etc.
  • In footer.php file, add the footer tags code like footer menu, address details, etc.
  • In script.php file, call the script files as shown in the image below:


Step 8:   Make a controller file:

  • Go to application/controllers folder.
  • Make a new controller file in this folder as shown in the image below:



Step 9:   Make a view file:

  • Go to application/views folder.
  • Make a new view file that you want to call from the controller that you created.