Archive for the ‘Codeigniter’ Category
Drag and Drop Shopping Cart Using ExtJS and CodeIgniter Cart
This is my other post about simple usage of ExtJS with CodeIgniter, this time I want to create a simple drag and drop shopping cart, I have learn about how to use the cart class in CodeIgniter that I have posted in the previous post, i’m using MySQL for the storing the product data. I prepared the mockup it something like this

Understanding CodeIgniter Cart Class
Cart is one of the most important feature when creating an online store. In this post I want to have more understanding about Cart Class in CodeIgniter, cause maybe come in handy in the future, you can see how many new online store out there open in business, and in this internet age, online store seems the must have for many people who have retail business, in this post I’m not writing about how to use it in some example, the code I posted in here just copying from the original cart class documentation, but i’m included the link to the example usage of this class on the section 4 below.
Cropping Image To Square Dimension With CodeIgniter
I’ve posted similar article before but this time I want to do it with codeigniter, codeigniter have a powerful image manipulation class, in this post I will use it to make thumbnail square from image, let get directly to the code. I make the function inside the controller, this code is cropping image that already located on the server so the image path (not URL) have to be defined.
CRUD using CodeIgniter and EXTJS Grid – Part 3
This is the final post of the series CodeIgniter and Extjs CRUD, if you want to read the previous posts, here the first part and the second part of this post. Basically we already finish all the crud feature on the second part this only another common feature to add in the application, so we will add a quick search field on the grid, and what you need is the search grid plugin, I’m using the extjs example search field plugin from this extjs grid tutorial, you can download the complete code and find this file searchfield.js and put it your desire folder, in this post i put on the “assets/js/ext/plugins/” folder. Now all you have to do just include the js file in the view file and change the controller method.
CRUD using CodeIgniter and EXTJS Grid – Part 2
This post is continuation of the part 1, in part 1 we already created the Extjs grid with pagination and load the store grid from the database, in this part we will add the save, edit and delete feature to that grid, and for make it easier it will use the editor grid.
First Edit The View ( in “application/views/user/index.php” )
We will use the editorGrid, one of them should be editable on the combobox field and the value is fetched from the database, so we create country store component and set like the code below (in this step we haven’t created the method to get all countries. it described in the controller section).
CRUD using CodeIgniter and EXTJS Grid – Part 1
In this post I want to share how to create simple CRUD (create, read, update, delete) using codeigniter ExtJS editor grid. In this first part, we will setup the database schema, codeigniter and extjs. I limited this first part, only setup fetching data from database and pagination grid in extjs grid.
1. Create Database Schema
The table that we will use is two tables with “has one” relationship, namely users table with foreign key country_id and countries table that store all the countries data, so when we want to know the country name from the users we have to get from the countries table, and here the sql for creating the table.
Basic Image Gallery With CodeIgniter
CodeIgniter is quite mature framework to creating web application, the built in libraries and helper very helpful to creating most feature in web application, this post I want to create very basic image gallery using CodeIgniter, the the built in libraries that I used are File Uploading, Image Manipulation and Pagination, whereas the used helper is URL Helper, and here’s we go
First open the config.php in folder system/application/config/ and set the CodeIgniter base_url
$config['base_url'] = "http://localhost/ci_gallery/";
Next load the URL Helper in autoload.php in the same folder as above file
$autoload['helper'] = array('url');
Now create the image controller in file image.php inside folder system/application/controller and add this attribute inside the image class
private $data = array(
'dir' => array(
'original' => 'assets/uploads/original/',
'thumb' => 'assets/uploads/thumbs/'
),
'total' => 0,
'images' => array(),
'error' => ''
);
Creating Register and Login Form Using EXTJS and CodeIgniter
Like another tutorial this post will create the basic form login and register using Extjs and Codeigniter, and I want to mix my previous post about Codeigniter Session Library, Extjs Unique Field Validation and using Statusbar in Extjs Window.
1. Setting up the database
Using phpmyadmin in XAMPP I create the database named “ci_extjs_login”, and create simple “users” table, here below is the sql code that I generated from phpmyadmin, for more advance database modelling you can use mysql workbench.
CREATE TABLE `ci_extjs_login`.`users` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 100 ) NOT NULL , `password` VARCHAR( 100 ) NOT NULL , `email` VARCHAR( 100 ) NOT NULL ) ENGINE = MYISAM ;
CMS List based on CodeIgniter
Codeigniter recently is my favorite PHP framework, it’s has really small learning curve to get move on, here list of content management system built on codeigniter, hope this useful whether you want to use it for your simple site or you can learn more about codeigniter by exploring the code. Personally I explore it to knowing how people write code in codeigniter.
Creating user session checking with CodeIgniter library
When we build web application with user authentification, the application must have user login/logout or signin/signout or whatever you called it, then the system must have user logged feature to check whether the user is logged in or logged out. Session is the most common way to checking it. In Codeigniter, using Session Class you can use simple function inside controller, it’s something like this:
class User extends Controller {
// constructor class
function __construct()
{
parent::Controller();
$this->load->library('session');
}
function index()
{
$this->load->view('user/index');
}
function login()
{
// if user already logged in, redirect to user index
if ($this->_is_logged_in())
{
redirect('user/index');
}
else
{
$this->load->view('user/login');
}
}
function register()
{
// if user already logged in, redirect to user index
if ($this->_is_logged_in())
{
redirect('user/index');
}
else
{
$this->load->view('user/register');
}
}
// checking user logged user by registered session
function _is_logged_in()
{
$logged = $this->session->userdata('user_id');
if ($logged)
{
return TRUE;
}
else
{
return FALSE;
}
}
}