2. Page 2
Dominant Infotech
"Dominant InfoTech” provides a comprehensive
range of web and software development outsourcing services.
Listed below are the core areas that we provide our services
in:
Web Development
Web Design
Mobile App. Development
E-commerce Solution
CMS Websites
SEO
Logo & Graphics Design
Provide Training
4. Page 4
Framework - what is a PHP framework?
A framework gives you standard solutions to typical problems,
e.g. for an online shop that can cover the functionality for a
customer login (including session handling), a shopping cart,
placing orders...
The big advantage of using a framework is that
You don't need to reinvent the wheel, the code is already
there.
The code (usually) works, it is already tested.
Specifically for user authentication, you will most probably
have fewer security leaks as if you invented something
from scratch yourself
5. Page 5
The big disadvantage is that
If you want to extend the functionality, you have to
understand OPC (other peoples code).
If the framework contains a security hole and an exploit is
available, your site is immediately vulnerable, but you
may not have the knowledge to fix it yourself. So you
need to keep a constant lookout on security bulletins,
updates, fixes etc.
List of Popular PHP Frameworks:
1. Zend 4. Symfony
2. Laravel 5. Cake PHP
3. Phalcon 6. Code Igniter
Continue
6. Page 6
There are pretty good reasons to use the Frameworks:
Code and file organization is extremely easy
Countless numbers of tools and libraries that can help you
with:
Form validation
Database abstraction
Input / Output filtering
Session and Cookie handling
Email, Calendar and pagination and much more
MVC (Model View Controller) Architecture
Security - PHP has many input and output filtering functions
which can add extra security layer to protect your website
against certain attacks.
Why Framework ??
7. Page 7
CI:- CodeIgniter (PHP Framework)
What is Code Igniter?
CodeIgniter is an application development framework, which can
be used to develop websites, using PHP.
CodeIgniter is a simple , elegant and powerful toolkit with a very
small footprint, used by those developers who want to create
full-featured Web Applications. CodeIgniter is an Open Source
PHP Framework.
It has a very rich set of functionality, which will increase the
speed of website development work.
8. Page 8
Reasons to use it:-
MVC design –It separates application into three interconnected parts
Model-View-Controller.
Performance – Its performance like speed and other functionality is
better among other PHP frameworks.
Database abstraction – It has a Active Record Database class so you
can easily perform insert, update and delete statements without needing
to write SQL queries. You can also handle connections to multiple
databases within one application.
Excellent documentation – Documentation of CI is the biggest
advantage over other frameworks. The CI knowledgebase covers every
topic that a user require.
Why To Use CodeIgniter ??
9. Page 9
Features of CodeIgniter:-
Extremely Light Weight.
Full Featured database classes with support for several platforms.
Query Builder Database Support
Form, Data Validation & Session Management
Email Sending Class. Supports Attachments, HTML/Text email,
multiple protocols (sendmail, SMTP, and Mail) and more.
Image Manipulation Library (cropping, resizing, rotating, etc.).
File Uploading Class & Pagination
Error Logging
Search-engine Friendly URLs
Flexible URI Routing
10. Page 10
CodeIgniter Installation
Step-1 − Download the CodeIgniter from the link CodeIgniter
Step-2 − Unzip the folder.
Step-3 − Upload all files and folders to your server.
Step-4 − After uploading all the files to your server, visit the URL
of your server, e.g., www.domain-name.com.
11. Page 11
CodeIgniter File System
After unzipping the CodeIgniter folder you will get a file hierarchy of
CodeIgniter files as shown below.
CodeIgniter file structure is mainly
divided into three parts:
1) Application:-Application folder is the main
development folder for you where you will develop
your project.
2) System: All action of CodeIgniter application
happens here. It contains files which makes
the coding easy.
3) User_guide: It is the offline CodeIgniter guide.
12. Page 12
CodeIgniter Architecture
Data flow in CodeIgniter
As shown in the figure, whenever a request comes to CI, it will first
go to index.php page.
In the second step, Routing will decide whether to pass this
request to step-3 for caching or to pass this request to step-4 for
security check.
13. Page 13
If the requested page is already in Caching, then Routing will pass
the request to step-3 and the response will go back to the user.
If the requested page does not exist in Caching, then Routing will
pass the requested page to step-4 for Security checks.
Before passing the request to Application Controller, the Security
of the submitted data is checked. After the Security check,
the Application Controller loads necessary Models, Libraries,
Helpers, Plugins and Scripts and pass it on to View.
The View will render the page with available data and pass it on
for Caching. As the requested page was not cached before so this
time it will be cached in Caching, to process this page quickly for
future requests.
Continue
14. Page 14
MVC Framework
CodeIgniter is based on the Model-View-Controller
(MVC) development pattern. MVC is a software
approach that separates application logic from
presentation. In practice, it permits your web pages to
contain minimal scripting since the presentation is separate
from the PHP scripting.
15. Page 15
The Model represents your data structures. Typically, your model
classes will contain functions that help you retrieve, insert and
update information in your database.
The View is information that is being presented to a user. A View
will normally be a web page, but in CodeIgniter, a view can also be
a page fragment like a header or footer..
The Controller serves as an intermediary between the Model, the
View, and any other resources needed to process the HTTP request
and generate a web page.
Continue
16. Page 16
CodeIgniter First Example
In a CodeIgniter framework URL a basic pattern is followed.
In the following URL,
http://abc.com/book/novel/
Here, 'book' is the controller class or controller name. 'novel'
is the method that is called.
It extends to CI_Controller to inherit the controller properties.
17. Page 17
2)Create file in Views
1)Create file in Controllers
Continue
An Example to print Hello World
18. Page 18
To run the file, follow the path
http://localhost/CodeIgniter/index.php/Hello/
Run the Controller file
Continue
19. Page 19
Database Configuration
In CodeIgniter, go to application/config/databse.php for database
configuration file. In database.php file, fill the entries to connect
CodeIgniter folder to your database.
20. Page 20
CRUD Operation In CI
We will understand how to insert data into database using Controller
model and view.
21. Page 21
DB Connection
Automatically connecting Database
The auto connectfeature will load your database class with every
page load.
To add auto connect go to application/config/autoload.php and
add the word database to library array.
Manually connecting Database
If you need to connect database only in some pages of your
project, you can use below code to add the database connectivity
in any page, or add it to your class constructor which will make the
database globally available for that class.
28. Page 28
cPanel is a web based hosting control panel provided by many
hosting providers to website owners allowing them to manage
their websites from a web based interface. This program gives
users a graphical interface from which they can control their
portion of the Unix server. The tools provided are designed to
simplify running and controlling a website. It uses a tiered
structure that allows different levels of access. Administrators
and end users can control the different aspects of the server
and the website directly through their browser. cPanel is
generally accessed using https on port 2083 or simply by
adding “/cPanel” to the end of the host name.
Web Hosting