Skip to main content

Introduction to CodeIgniter

Introduction

I've been playing around with CodeIgniter as my PHP web framework for a while now and I would like to share my simple steps in getting started with the tool. I think it's maybe too late to post this one up on the internet as there are lots of articles describing the said tool. But anyway, I'll just post this one so that I have some reference in the future how I did things to work with CodeIgniter.

CodeIgniter is a simple, light and fast web framework.

And web frameworks are encapsulation of the repetitive tasks we do when developing a website. One of the many important issue solved by this framework is maintenance. We get to have our code separated so that we have proper maintenance of our site. When I say separation of code, it's a conceptual thing. Web framework, most if not all, are implementation of the MVC pattern where we separate logic from presentation. It's model and view respectively. And CodeIgniter does that with ease.

Let me demonstrate. Mostly we do have actions as our PHP scripts, i.e. listcustomers.php to list all our customers. And we have code inside like so:

For some simple sites this works but imagine we'll have other scripts that does similar to this like listvendors.php, listitems.php. I'd imagine we'll separate the part where the connection is and include it in all of these scripts. Yes it solves the problem.

Download and Install

You need to have a web server and a PHP interpreter to run PHP and optionally we can install MySQL. I know these are lots but need not to worry. There's XAMPP to help us. Download and install XAMP and we've got all three working and ready to use.

Visit CodeIgniter website to download the said package. Assuming we put XAMPP to C:\xampp, we can unzip the package to C:\xampp\htdocs\codeigniter and that's it. We can now access the page through our browser. Open up your browser of choice and go to http://localhost/codeigniter/. Voila! We have a codeigniter website up and running.

Comments

Popular posts from this blog

Restoring .dat data to MSSQL

This is just a document in case I forgot to restore data files to MSSQL. I had this problem before when a colleague gave me a .dat files to be restored to SQL server. I had a 2008 version of the server and had no trouble restoring it. The problem is, I forgot how I did it when I had a new PC and I upgraded it to 2012 SQL server. But this is a simple task (although I had a full day remembering how I did it and I had no luck finding the solution from google). First off, click restore, like so I had trouble with the database whether or not to add a new database and restore the file to it, or not. Simple answer is no need. With the next image you can see that the configuration is very simple. Just set it to device as the source and find the .mdf file. It automatically displays a suggestion for the database name and you're done. Click OK and wait a couple of minutes for SQL server to restore the data. [EDIT] In case you are restoring a backup file without an extension. You c...

Python Hydrology

Recently I'm learning Python and encountered the Hydrology book. Had to upgrade some of python packages and some libraries needed to get working with the book. There is an instruction though about mostly using pip install packages need for the book. The problem is I can't get it work. It's missing some things so I did a little google and hopefully this is a compilation of the things I need to work with the examples of the book. First off, I updated the apt-get $ sudo apt-get update Next is I installed the pip package manager. I'm not too sure but I have Ubuntu 10 and it doesn't have the pip installed. So I installed using the command below. $ sudo apt-get install python-pip Now the development packages for python. $ sudo apt-get install python-dev Most of the examples uses the scientific number packages so I installed numpy and other packages I'm not quite aware of. It's just that some of the examples probably in the later part of the book use...

Setting Up IIS on a Local Network: A Developer's Journey

Today, I embarked on a mission to set up an IIS server on our local network. The primary objective? To create local network versions of our applications for testing and development purposes. Additionally, we're in the process of setting up a CI/CD server to automate our workflows. However, like many journeys, this one had its share of hurdles. The initial hiccup arose when I realized that .NET was installed before IIS, leading to compatibility issues. Despite attempting to install IIS through the control panel and tweaking .NET components, the problem persisted. "Nada." After some trial and error, a breakthrough emerged. The solution? Executing dism as an Administrator in the C:\Windows\Microsoft.NET\Framework\v4.0.30319 directory: \> dism /online /enable-feature /featurename:IIS-ASPNET45 /all And just like that, the clouds parted, and the path forward became clear. With IIS up and running seamlessly, our developers rejoiced, and testing commenced with renewed vigor. H...