Create a simple blog using CodeIgniter 2 – Part 3

For this CodeIgniter tutorial, I will demonstrate how to add category to our post in the blog and how to use Ion_Auth as our authentication library. This is a continuation from the past tutorials which are Part 1 and Part 2. However, I do recommend to you to download and look at the full source code of this tutorial because my explanation here maybe too short/simple. You may view the demo for final product here: CodeIgniter Blog

I would like to remind you guys to use the latest CodeIgniter version for better functionalities and security. You can look at the CodeIgniter user guide on how to update your CodeIgniter framework. You also can download the latest stable Ion_Auth library at github.

The steps for Part 3 as follows: Continue reading Create a simple blog using CodeIgniter 2 – Part 3

Create a simple blog using CodeIgniter 2 – Part 2

In this CodeIgniter tutorial, I’m going to show you how to create a blog post with comment function with CodeIgniter 2. You can download the code or just preview the final product first. In this version of code, I’ve created a simple template for our blog.

You can preview the part 1 of this tutorial at Create a simple blog using CodeIgniter 2 – Part 1.

1. Create a table for comment

CREATE TABLE IF NOT EXISTS `comment` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`entry_id` int(11) NOT NULL,
`comment_name` varchar(255) NOT NULL,
`comment_email` varchar(255) NOT NULL,
`comment_body` text NOT NULL,
`comment_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Continue reading Create a simple blog using CodeIgniter 2 – Part 2

Create a simple blog using CodeIgniter 2 – Part 1

This entry will demonstrate to you on how to code a simple blog by using CodeIgniter 2. You may use whatever web server environment that you prefer such as Xampp, Lamp, Wamp, or Mamp. In this tutorial, I would like to use Wamp.

At the end of the tutorial, you should have a simple blog system with comment function. To download the complete source code, scroll down to the end of this tutorial. You also may want to view the final product first.

1. Setup a database

In the database named as blog, we will create a table, table ENTRY. The ENTRY table has columns such as entry_id, entry_name, entry_body, and entry_date (This is just a sample). The code is as below:

CREATE TABLE IF NOT EXISTS `entry` (
`entry_id` int(11) NOT NULL AUTO_INCREMENT,
`entry_name` varchar(255) NOT NULL,
`entry_body` text NOT NULL,
`entry_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`entry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Continue reading Create a simple blog using CodeIgniter 2 – Part 1