Tutorial Creating a Simple Program on the CodeIgniter Framework

in #utopian-io7 years ago

In the example program below will show how to make pharmacy program included database creation, login, validation form and Create, Read, Update, Delete (CRUD).

Database Preparation

The first step is to design and create a database. Why? Because the database will be closely related to the course of program data to be created. In the following tutorial will be used XAMPP server applications.

Create a database named db_apotik or another, then copy the code below with instructions as below:

capture-20171216-193633.png
capture-20171216-193833.png
capture-20171216-193949.png
capture-20171216-194102.png
capture-20171216-194219.png
After you copy and click GO then the table is made like the following:

capture-20171216-194428.png

Templating

In this tutorial will be used template sb admin 2. To get template sb admin 2 can be downloaded at following link : https://startbootstrap.com/template-overviews/sb-admin-2/.

Prepare the CodeIgniter package, then extract it and copy it into the C: \ xampp \ htdocs folder or where you installed the XAMPP. (You can rename the folder). Here I give the codeigniter name.
capture-20171216-194748.png
Extract also sb admin 2 package that you have downloaded. Copy it into the codeigniter folder of the previous htdocs folder and Open the codeigniter folder in sublime
capture-20171216-194928.png
Configuring 4 CodeIgniter files. You can see in chapter 3 point 3.2, for a customized database with the name of the database you created
Create a new file named template.php in application / views / folder.
capture-20171216-195244.png
Now open the blank.html file in the sbadmin2 / pages / folder. And copy all the code into template.php file.
In the template.php file look for the div tag that is in the comment. Delete 1 div tag.
capture-20171216-195518.png
Replace the above coding with the coding below:
capture-20171216-195653.png
main_view will be called with another view file containing as content from its web page. So we do not need to create headers and footers in every view created.

Login

After doing templating, then we try to create login page to enter into application. For the login page template you can download it yourself as you wish.

After downloading the template for the login page you can create its content as in the syntax below. Noteworthy on the form tag. The placeholder is used for the shadow name on the input form. And note also the name on each tag input.Untuk checking later you can enter the manual on the database (table Admin) and give MD5 for the password.

capture-20171216-200027.png
We also need to create a Controller file from this login page. Create a file in the controllers folder with the name Login.php. The syntax that needs to be written in Login.php file as follows:
capture-20171216-200253.png

Next, create a Model file in the models folder named Login_model.php. The model on this login is used to check the user in the database. The syntax that needs to be written in the file Login_model.php as follows:
capture-20171216-200438.png
When finished creating the view file, controller and model then the program code is ready to run. Open your browser, and do not forget to enable XAMPP (Apache and MySQL).

Result:
Preferences when accessing login page. There are 2 inputs namely Username and Password.

capture-20171216-200719.png
There is a form validation on this login page. When clicking the Login button, without you fill in Username and Password (blank), validation form will appear, as shown below.

capture-20171216-200904.png



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Very nice thank you for sharing, will try.

Very well explained thank you.

You are welcome

Greats... I follow, follow back

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @bustami83 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65248.25
ETH 3471.40
USDT 1.00
SBD 2.51