Posts Tagged "library"

8 Javascript Mobile Web Image Gallery Library

August 7th, 2011 by aditia rahman / No Comments  

     

This post I compiled some examples I found for creating image gallery in mobile web, cause compared to web desktop, creating image gallery in mobile devices must be different, we have to thinking about limited screen resolution, supported event, etc. And these library & tutorial might help you to get started creating your own mobile web gallery, and some of them a have tried it on my local computer, using iPhone simulator.

Photo Swipe

PhotoSwipe is a free HTML/CSS/JavaScript based image gallery targeting mobile devices, demo.

Codeigniter Layout Library For Autoload Frequently Used Views

May 2nd, 2011 by aditia rahman / 11 Comments  

     

I came up with idea how to automatically load most used layout in Codeigniter, basically I came from CakePHP that automated all default layout, in this case we can call it views part of MVC, when creating codeingniter application usually I follow the documentation when load some views from controller, something like this code

$data['page_title'] = 'Your title';
$this->load->view('header');
$this->load->view('menu');
$this->load->view('content', $data);
$this->load->view('footer');

Or the worse before this sometimes I include the header and footer directly on the view file, well these method really wasting time, an make the code on the views not really well organized.

Creating user session checking with CodeIgniter library

April 17th, 2010 by aditia rahman / 15 Comments  

     

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