Framework
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>
This is what m searching for a week.. i think this is a perfect introduction for beginner (CodeIgniter) like me..
[...] Starting Project with Code Igniter [For beginners] Part 01 Posted by Masud in Apache Server, CodeIgniter, HTML/DHTML/CSS, My Thinking, PHP, Programming on 01 5th, 2008 | no responses [...]
I am just a beginner in codeigniter..Can Anybody please help me in finding out the right path for the preparations ..Or please help me in finding out some projects whhich I can understand the basic implementations through codeigniter.