I used Codeigniter recently on a local project and thoroughly enjoyed in the experience compared to all of the other frameworks I have used in the past. I like how it doesn't force certain practices and conventions on you but still gives you the same workflow that you'd be used to if you've used an MVC framework in the past.
What I'm aiming for in this project is to introduce more people to CI and show solutions to many questions and problems I ran into during development but in a fun, practical way. This series of tutorials is aimed at intermediate to advanced programmers/web developers. You should at least know basic php/oop conventions and know how to work with database structures. I will explain things as I go and be sure to comment code, but will not explain things that would often be considered basic.
Setup
In order to follow this tutorial, you will need two things:
- Access to Php/mysql server. If you do not have your own webserver, you can set up something simple and private for yourself with XAMPP.
- To download the codeigniter framework (currently 2.1.3)
- To download the Codeigniter Tank Auth plugin
Once you have downloaded codeigniter, go ahead and unzip it and copy it either to the server you'll be working from or the webroot directory in XAMPP (c:\xampp\htdocs\ by default)
Once you've done that, you'll want to do the same with the Tank Auth zip file and upload it to the root as well, overwriting any files or folders it asks you to. Your folder setup should look like this:
Now, we need to do something with that schema file. Tankauth relies on a specific database structure for good login security, so next we'll need to set that up and accommodate for those requirements.
What we'll need to do, is create a database first and import the schema.sql into your mysql database. Below is an image showing how to do that in popular database management program Phpmyadmin.
You may not have to do steps one and two if you have a host like Hostgator that manages your mysql for you. Whatever your setup, be sure you note the full name of the database that you create, as it will be needed to finish the configure.
There is just one more thing we'll want to configure and we'll be done with the initial setup here. With your favorite text editor (if you don't have one, I recommend Notepad++, or Komodo Edit if you want a more fully featured editor), open up the following file <webroot>/application/config/database.php and look around line 51. We'll want to change the information to match whatever information we have setup earlier.
The above are my settings, for my personal server. If you're on shared hosting or actually care about your security, you'll likely have a password and not be using root to log into mysql. Once you modify that information to match the database you set up earlier, go ahead and save the file. At this point, we should be good to go and ready to begin actually throwing down some code.
Next time, we'll cover Codeigniter forms by looking at and modifying the default Tank Auth login/registration system as well as go over some goals at other information about the little text-based RPG we'll be making here.
What do you think of this tutorial? Is this something you'll enjoy, possibly share? Leave your comments below, I'd be glad to hear your thoughts on this little project.
Now, we need to do something with that schema file. Tankauth relies on a specific database structure for good login security, so next we'll need to set that up and accommodate for those requirements.
What we'll need to do, is create a database first and import the schema.sql into your mysql database. Below is an image showing how to do that in popular database management program Phpmyadmin.
You may not have to do steps one and two if you have a host like Hostgator that manages your mysql for you. Whatever your setup, be sure you note the full name of the database that you create, as it will be needed to finish the configure.
There is just one more thing we'll want to configure and we'll be done with the initial setup here. With your favorite text editor (if you don't have one, I recommend Notepad++, or Komodo Edit if you want a more fully featured editor), open up the following file <webroot>/application/config/database.php and look around line 51. We'll want to change the information to match whatever information we have setup earlier.
$db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = ''; $db['default']['database'] = 'rpg';
The above are my settings, for my personal server. If you're on shared hosting or actually care about your security, you'll likely have a password and not be using root to log into mysql. Once you modify that information to match the database you set up earlier, go ahead and save the file. At this point, we should be good to go and ready to begin actually throwing down some code.
Next time, we'll cover Codeigniter forms by looking at and modifying the default Tank Auth login/registration system as well as go over some goals at other information about the little text-based RPG we'll be making here.
What do you think of this tutorial? Is this something you'll enjoy, possibly share? Leave your comments below, I'd be glad to hear your thoughts on this little project.



No comments:
Post a Comment