PHP programmer of bangladesh
A PHP Programmer of Bangladesh

Starting Project with Code Igniter [For beginners] Part 01

January 5th 2008 in Apache Server, CodeIgniter, HTML/DHTML/CSS, My Thinking, PHP, Platform, Programming

Framework

codeigniter

System

System folder contains all the framework files including framework build class libraries, fonts, database configuration for your system, languages files, helper classes etc.

Application

Projects basis works will place inside this folder. Projects controller class will be placed inside Controller, projects database related class will be placed inside Model, Template based work will place inside Views folder. User defined libraries will be place inside libraries. Projects oriented application configuration will be done inside config folder such as autoload, routes etc.

Starting a Project

To start a project, some basic configuration needs to done. We will gone through the basic configuration step by step:

· Set the root path for your project

o Open system/application/config/config.php file and then edit the following line as follows:

   1: $config['base_url'] = "http://localhost/ ";

To

   1: $config['base_url'] = "YOUR_PROJECT_LOCATION";

· Set the Autoload functionality

Autoload is a magic function of PHP5.0 which dynamically load the entire user defined or framework based class when you create an instance of a class. So you can defined some default class which will load when the projects run. Like we need the database class library and session class library every time, so you can defined them inside autoload.php file.

o Open system/application/config/autoload.php file and then edit the following thing:

   1: $autoload['libraries'] = array('database', 'session');
   2: $autoload['helper'] = array('url', 'string');

· Set the Project default controller

It is very important which controller will load when a URL is browsed. This is set inside routes.php file.

o Open system/application/config/routes.php file and edit the following line:

   1: $route['default_controller'] = "CONTROLLER_NAME";

· Set .htaccess file for security reason

It is one of the major fact for the programmer to make sure the project security. Therefore .htaccess plays a vital role. We will use mod_rewrite functionality of apache modules. This module is by default inactive. so this needs to activate in the following manner.

o Open the httpd.conf file.

o Search for the line

   1: #LoadModule rewrite_module modules/mod_rewrite.so

o Replace it with the following line:

   1: LoadModule rewrite_module modules/mod_rewrite.so

o Restart apache service.

o Place the following code inside .htaccess file

   1: <IfModule mod_rewrite.c>
   2:     RewriteEngine On
   3:     RewriteBase /YOUR_PROJECT_ROOT_FOLDER_LOC
   4:     RewriteCond %{REQUEST_FILENAME} !-f
   5:     RewriteCond %{REQUEST_FILENAME} !-d
   6:     RewriteRule ^(.*)$ index.php/$1 [L]
   7: </IfModule>
   8:
   9: <IfModule !mod_rewrite.c>
  10:     # If we don't have mod_rewrite installed, all 404's
  11:     # can be sent to index.php, and everything works as normal.
  12:     # Submitted by: ElliotHaughin
  13:     ErrorDocument 404 /index.php
  14: </IfModule>

Trackbacks

close Reblog this comment
blog comments powered by Disqus

Happy New Year, 2008

Thanks to all mighty Allah, that i have finally passed another year. In the same way i lost one of my valuable year from my life. I have some good and painful experience through out the year, 2007. I lost my only anti(father sister) and my adorable grandmother. I wish to almighty Allah to reward [...]

Happy New Year, 2008Previous Entry

Our first dating with Moonrise!!!!!!!!

From last couple of months we are working in a social networking site called moonrise. we are creating the site with Flickr, Youtube, Twitter API. For this reason we are passing a very hard time with it. Especially Bejon, Emran and myself facing the most of the challenges. Now we get a deadline to make [...]

Our first dating with Moonrise!!!!!!!!Next Entry

Where i am ???



Currently I am working in Right Brain Solution(RBS) as a Software Engineer(Team Leader). I start my journey in RBS from 6th Nov, 2007.
Where i Was???
I am a php professional from Bangladesh. I start my journey as a professional from 1st july, 2006 in EVOKNOW Incorporation. I was there for one and half year. My Position was there "Software Engineer(Lead Developer)". I left EVOKNOW at 5th Nov, 2007.
Self Formed
I do some freelancing work with some of my friends under this name. Our dream is to make it world famous in the field of web development & solution. If you would like to work with us, send us your proposal to technopeoplebd@gmail.com
Social Networks
View Md. Mahabubul Hasan Masud's profile on LinkedIn
Moonrise: What i feeling???
Feelings from moonrise
More items See these feelings on moonrise