Posts Tagged ‘snippet’

Drag and Drop Shopping Cart Using ExtJS and CodeIgniter Cart

August 21st, 2010   by  aditia rahman

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

Posted in Codeigniter Extjs5 Comments

ExtJS: Passing Parameter in Function Handler

July 31st, 2010   by  aditia rahman

This is a very short post in my ExtJS posts, when we dealing with handler config in many component sometimes we want to passing the parameter inside the function, so here the simple code on how I do it

Ext.onReady(function() {
    var myHandler = function (name){
       Ext.Msg.alert('Notification', 'Hello ' + name);
    };

    var form = new Ext.FormPanel({
        frame: true, border: false, buttonAlign: 'center',
        url: 'test.php', method: 'POST',
        buttons: [{
            text: 'Submit Test',
            handler: myHandler.createDelegate(this, ['Luffy'])
        }]
    });

    var winLogin = new Ext.Window({
        title: 'Function Handler Parameter',
        layout: 'fit', width: 200,
        height: 80, resizable: false,
        border: false,
        closable: false, items: [form]
    });
    winLogin.show();
});

Posted in ExtjsNo Comments

Extjs: Simple Image Gallery Using DataView and PHP

July 21st, 2010   by  aditia rahman

Last week I tried some of the extjs dataview example, it really great, just my thought, why not creating simple image gallery with dataview? All that we need is provided in the example (the panel, fileinputfield, the xtemplate) and this is the page wire frame that I created using Pencil Firefox Plugins.

Ext JS Dataview Gallery Wire Frame

Posted in Extjs PHP6 Comments

Cropping Image To Square Dimension With CodeIgniter

July 14th, 2010   by  aditia rahman

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.

Posted in Codeigniter1 Comment

Cropping Image to Square Dimension Using PHP

July 1st, 2010   by  aditia rahman

When I wrote my previous post about creating image gallery with codeigniter, I browse some popular image sharing service, and I spent most of my time in flickr, till now I think flickr is still the best photo sharing on the net, when we search on flickr, there are many result that displayed only the thumbnail photo, for example you can see on the screen that I captured

Search Home Design On Flickr.com

Posted in PHPNo Comments

Creating user session checking with CodeIgniter library

April 17th, 2010   by  aditia rahman

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;
		}
	}
}

Posted in Codeigniter PHP3 Comments