CodeIgniter Tutorial:- Here, Codeigniter has a based framework for PHP. So,it has a reusable capability in this framework its has also used MVC (model view controller ).
Here, We guide all points and concepts relative to Codeigniter as well as, getting a project in which many functionalities over there. Similarly, how to use CodeIgniter and format using Codeigniter function.
So, here is each solution of Codeigniter by the web learn smart. we also provide a Codeigniter pdf with example.
Table of Contents
Codeigniter Tutorial step by step
Here, there is a list of Codeigniter and describe all points below.
- How to make a small project in CI with example.
- What is Codeigniter?
- How to setup CodeIgniter step by step.
- Why we use Codeigniter.
- How to install.
- Codeigniter file structure.
- How to use Codeigniter with example.
- Provide all link insert data, update, select, and delete in CI.
- How to use MVC(model view controller ) in Codeigniter.
What is Codeigniter
Hence, Codeigniter is an open-source web application framework. Also, it has to provide powerful tools for the developer. It can be used friendly for each task.
It handles and creates bits of help in creating powerful web applications with more structure and designing in programming.
Codeigniter provides more than own functionality of reusable source code for the better web application.
Why We use Codeigniter
We should be mostly preferred powerful framework Codeigniter for the web application. It has PHP open-source framework and here is more then Codeigniter tools.
Codeigniter tools help developers reusable codes with the help of CI.
It has a popular framework of PHP for web applications. Provides all source codes and guide step by step. Go to Codeigniter official websites Codeigniter user guide How to install.
How to Install Codeigniter
Here are some steps and follow this step.
Go to web search type Codeigniter we provide the link download CodeIgniter here. After that go to the server directory put these download files.
- If you are using local wamp/xampp server so put files www file.
- The default file name is Codeigniter. If you change the project name you can change.
Thus Now you can see all CI file directories and start your projects.
Codeigniter File Structure
Here are both types of files folder in which default and user So we are using for custom codes users. you Can see the image file structure.
After that Now going to tools firstly we are using user tools. So in these files click application files there are more then files see above image.
Cache:- So the top of the files cache we are using these files define our cache data.
Config:- In this file more then sub files so I describe in which use. we can be use database files here is an automatic crate database code, therefore, we take to do the only the name of the database.
This config Files only using the directories file path in which we using in own projects.
Libraries:- In this files using default tools like form and database.
Helpers:- In this files similar libraries like validation card and URL.
How to use Codeigniter Tutorial with example
When you have to do setup your files and run your projects on the browser again you see interface your page output.
check your address bar and put the link of your projects see below image also check another about bank login system HDFC NetBanking Login Forgot Password
http://projectsname.com and localhost/project name
How to use MVC (Model View Controller) in Codeigniter
The model view controller is a structure in which using developers while programming. this structure very easily useful and helpful. Through this pattern easily control codes.
Model:- When you are writing code of database query and login in this file this is back end. So firstly you create a file for model and also mention your class and function in these files.
View:- It is an interface here is mentions only front end area codes.
Controller:- controller to do control both file model and view and also a response by the user and take action through the controller also mention login in these files.
Model.php
<?php
class Name extents ModelCI
{
Public funtion ()
{
echo "here your model codes....";
}
}
?>
View.php
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
Controller.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
Class Home extends CI_controller
{
public function show()
{
$this->load->view('home');
}
}
?>
Basic project in Codeigniter Tutorial
Here is model files source codes login user.
loginuser.php
<?php
class loginmodel extends CI_Model
{
public function isvalidate($username,$password)
{
// $q=$this->db->where('username','password')
// ->where($username,$password)
// ->get('users');
$q=$this->db->get_where('users', array('username' => $username,'password' => $password));
if($q->num_rows())
{
return $q->row()->id;
}
else{
return false;
}
}
public function articlelist()
{
$id=$this->session->userdata('id');
$q=$this->db->select('article_title')
->from('articles')
// ->where(['id'=>$id])
->get();
return $q->result();
}
}
?>
Here are the view parts of file source codes.
login.php
<!DOCTYPE html>
<?php include('header.php');?>
<div class="container"style="margin-top: 20px;">
<h1>Admin Form</h1>
<?php echo form_open('admin/index'); ?>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="username">username :</label>
<input type="text" class="form-control" id="email" name="uname">
</div>
</div>
<div class="col-lg-6">
<?php echo form_error('uname'); ?>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="pass">password :</label>
<input type="password" class="form-control" id="pwd" name="pass">
</div>
</div>
<div class="col-lg-6">
<?php echo form_error('pass'); ?>
</div>
</div>
<button type="submit" class="btn btn-default">submit</button>
</div>
<?php include('footer.php');?>
Here are controller files source codes.
admin.php
<?php
class Admin extends MY_Controller
{
// public function __construct() {
// parent::__construct();
// if($this->session->userdata('id'))
// return redirect('admin/welcome');
// }
public function index()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('uname','user name','required|alpha');
$this->form_validation->set_rules('pass','password','required');
if($this->form_validation->run()){
$uname=$this->input->post('uname');
$pass=$this->input->post('pass');
$this->load->model('loginmodel');
$id=$this->loginmodel->isvalidate($uname,$pass);
if($id)
{
$this->load->library('session');
$this->session->set_userdata('id',$id);
return redirect('admin/welcome');
}
else{
echo "details nor matched";
}
}
else{
$this->load->view('admin/login');
}
}
public function welcome(){
$this->load->model('loginmodel');
$articles=$this->loginmodel->articlelist();
$this->load->view('admin/dashboard', array('articles'=> $articles));
}
}
?>
users.php
<?php
class Users extends MY_Controller
{
public function index()
{
$this->load->view('users/articlelist');
}
}
?>
So We will soon give you Codeigniter projects Insert update select and delete we will provide a link soon.
Another you want to learn about Python Absolute Value click and check.
Also learn you can see HTML Syntax Example on this link post.
Conclusion
Here, We cover all points of Codeigniter tutorial now, you must be set up the Codeigniter framework and will be stated word with it. So, if you have any queries drop-in command section. Also, Learn popular topic find than Primary Key SQL
I’m extremely impressed with your writing skills as well as with the layout on your blog.
Is this a paid theme or did you modify it yourself?
Anyway keep up the excellent quality writing, it is rare
to see a nice blog like this one today. It is the best time to make some
plans for the future and it’s time to be happy.
I’ve read this post and if I could I desire to suggest you few interesting things or suggestions.
Maybe you could write next articles referring to this article.
I wish to read more things about it! I’ll immediately grab your rss feed as I can not to find your email subscription hyperlink
or e-newsletter service. Do you have any? Please allow me understand so
that I may subscribe. Thanks. http://starbucks.com
965099 539059I like this post a good deal. I will surely be back. Hope that I is going to be able to read far more insightful posts then. Will probably be sharing your expertise with all of my associates! 829071
Way cool! Some extremely valid points! I appreciate you
penning thiss article and the rest of the website
is also really good.
Cialis and viagra together viagra order cialis online 37.5 buy cheap cialis online
When I originally commented I seem to have clicked
on the -Notify me when new comments are added- checkbox and now every time a comment is added I
recieve four emails with the same comment. There has to be an easy method you are able to remove me from that service?
Thanks a lot!
Some truly nice and useful info on this site, too I think the layout holds fantastic features.
thank you, dear
Hi to every body, it’s my first pay a quick visit of this web site; this blog carries remarkable and really good information designed for readers.
tҺe website іѕ really good, I enjoy your web site!
Saved as a favorite!, I enjoy your blog!
Saved as a favorite!, I like your website!
tҺe website іѕ really good, I like your blog!
First time visiting your website, I really like it!
Having read this I believed it was really enlightening.
I appreciate you taking the time and energy to put this
short article together. I once again find myself spending a significant amount
of time both reading and commenting. But so what, it was still worthwhile!
This will be a fantastic web page, would you be involved in doing an interview regarding how you created it? If so e-mail me!
Wow that was unusual. I just wrote an extremely
long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again. Anyway,
just wanted to say excellent blog!
I absolutely love your blog.. Pleasant colors & theme.
Did you develop this site yourself? Please reply back as I’m
wanting to create my very own site and would
love to know where you got this from or just what the theme is named.
Kudos!
thanks for asking… this is my own themes if you want you can contact me mitm786@gmail.com
Hello! This is kind of off topic but I need some help from an established blog.
Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
I’m thinking about setting up my own but I’m not sure where to begin.
Do you have any ideas or suggestions? Thanks
Sure I can help you index me.
Hi there everybody, here every one is sharing these knowledge,
therefore it’s fastidious to read this web site, and I used to pay a visit this
weblog all the time.
Sure..welcome
I was able to find good information from your articles.
Thanks…
I savor, result in I discovered just what I used to be looking for.
You have ended my 4 day long hunt! God Bless you man. Have a nice day.
Bye
welcome..sir