Programming Codeigniter How to create a new CodeIgniter project

How to create a new CodeIgniter project

How to create a new CodeIgniter project - Techbriefers

As you have gone through the previous tutorials of this CodeIgniter Tutorial series. You must be aware of the basics of the CodeIgniter framework. How I prefer learning anything is by working on it. I software development, the best way to learn is by creating projects. So I am explaining here that How to create a CodeIgniter Project. This will enforce you to learn quickly.

To create a CodeIgniter project, firstly we need to install it. You can install CodeIgniter in two ways.

  1. By composer
  2. Simply by downloading folder and working with XAMPP or WAMP or LAMP etc.

In this tutorial, I am explaining the simplest way to start with. In this method, simply download a copy and start working in simple steps.

How to install CodeIgniter in the simplest way

Step 1: Download the framework

Got to and download the latest stable build. As I am showing in the screenshot below, I have chosen CodeIgniter 3. When you will click on the download link, a zip file will be downloaded on your system.

Download page of - techbriefers

Step 2: Extract the zipped files.

Now you will have to extract the zipped files to the folder. When you will unzip the folder then, a folder will be created named “CodeIgniter-3.1.10” in which all files will be present.

Step 3: Create a project folder

To create a web project you need a web server on your system. You can choose any web server Like XAMPP or WAMP or LAMP. I am using XAMPP Web server.

In XAMPP, you need to create a project folder in XAMPP/htdocs folder. However, if you are using WAMP then create your project folder in the www directory of WAMP. I am creating a project folder with name = “cidemo”.

Step 4: Move all CodeIgniter files to project folder

You can keep the folder name of your choice. I recommend naming the folder on your chosen project name. Like: My First Web is your project, and then give the name you folder like “myfirstweb”.

Now, move all the files from the “CodeIgniter-3.1.10” folder to “cidemo” (or your project folder). You can skip or delete user_guide, it’s your choice.

CodeIgniter files - techbriefers

Your project is created with the default pages by CodeIgniter. Go to the browser and enter the URL http://localhost/cidemo/. It will display the default page which will look like below image.

How to Change Welcome page of CodeIgniter

After finishing the installation of the CodeIgniter framework, we get a welcome page. It also displays a heading Welcome to CodeIgniter!

To show this page there is a default controller given by the framework named Welcome. It has a few lines of code which is responsible for showing such a page. The code is:

As you can see in the code above, a view is called to show the welcome page. That view is welcome_message.php. This file resides in application\views folder. To change a welcome page, you need to change the HTML code in this file.

To change welcome page, simply replace body tag code to the code I am giving below.

And put this code in the head section of HTML.

This will create a new layout of your welcome page.

Leave a Reply