<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Superdit.com &#187; library</title>
	<atom:link href="http://superdit.com/tag/library/feed/" rel="self" type="application/rss+xml" />
	<link>http://superdit.com</link>
	<description>blogging, design, tech, and web</description>
	<lastBuildDate>Sat, 31 Mar 2012 20:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>8 Javascript Mobile Web Image Gallery Library</title>
		<link>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/</link>
		<comments>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 04:31:06 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=4102</guid>
		<description><![CDATA[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 &#38; tutorial might help you to get started creating your own mobile<a href="http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>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 &amp; 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.</p>
<h5>Photo Swipe</h5>
<p>PhotoSwipe is a free HTML/CSS/JavaScript based image gallery targeting mobile devices, <a href="http://www.photoswipe.com/latest/examples/jquery-mobile.html" target="_blank">demo</a>.</p>
<p><a href="http://www.photoswipe.com/ " target="_blank"><img title="" src="http://superdit.com/wp-content/uploads/2011/08/04.png" alt="" width="488" height="332" /></a></p>
<h5><span id="more-4102"></span>Awesome Mobile Image Gallery Web App</h5>
<p>This is a tutorial blog post written by tympanus.net, really good example to showing step by step creating mobile web image gallery using jQTouch, <a href="http://tympanus.net/Tutorials/WonderwallMobileGallery/" target="_blank">demo</a>.</p>
<p><a title="Awesome Mobile Image Gallery Web App" href="http://tympanus.net/codrops/2010/05/27/awesome-mobile-image-gallery-web-app/" target="_blank"><img class="alignnone size-full wp-image-7939" title="" src="http://superdit.com/wp-content/uploads/2011/08/01.png" alt="" width="489" height="331" /></a></p>
<h5>Tiny Circleslider</h5>
<p>Tiny Circleslider is a circular slider or carousel build based on jquery library, this one have a unique interface as a gallery to be used, the radius size can be customized so it will fit in any mobile devices.</p>
<p><a title="Tiny Circleslider" href="http://baijs.nl/tinycircleslider/" target="_blank"><img class="alignnone size-full wp-image-7940" title="" src="http://superdit.com/wp-content/uploads/2011/08/02.png" alt="" width="490" height="331" /></a></p>
<h5>Touch Gallery</h5>
<p>A fullscreen photo gallery for touch-devices.</p>
<p><a title="Touch Gallery" href="http://neteye.github.com/touch-gallery.html" target="_blank"><img class="alignnone size-full wp-image-7941" title="" src="http://superdit.com/wp-content/uploads/2011/08/03.png" alt="" width="498" height="330" /></a></p>
<h5>jQTouch Extensions</h5>
<p>jQExtensions is a collection of extensions for the jQTouch mobile web app framework based on jQuery. This one already discontinued but have a good example used to creating simple photo gallery, <a href="http://samshull.com/jqtouch-r148/demos/main/#home" target="_blank">demo</a>.</p>
<p><a title="jQTouch Extensions" href="http://code.google.com/p/jqextensions/" target="_blank"><img class="alignnone size-full wp-image-7943" title="" src="http://superdit.com/wp-content/uploads/2011/08/05.png" alt="" width="489" height="331" /></a></p>
<h5>Jaipho</h5>
<p>Jaipho is a mobile web gallery inspired by original iPhone photo application, <a href="http://www.jaiphodemo.info/" target="_blank">demo</a>.</p>
<p><a title="Jaipho" href="http://www.jaipho.com/   " target="_blank"><img class="alignnone size-full wp-image-7945" title="" src="http://superdit.com/wp-content/uploads/2011/08/06.png" alt="" width="489" height="331" /></a></p>
<h5>Galleria</h5>
<p>I&#8217;m not really testing this one but from the documentation you can see swipe features, which mean you can use it on mobile devices.</p>
<p><a title="Galleria Aino" href="http://galleria.aino.se/ " target="_blank"><img class="alignnone size-full wp-image-7946" title="" src="http://superdit.com/wp-content/uploads/2011/08/07.png" alt="" width="489" height="331" /></a></p>
<h5>TN3 Gallery</h5>
<p>Like galleria I&#8217;m not really testing this one but from the sites says it supported mobile devices.</p>
<p><a title="TN3 Gallery" href="http://www.tn3gallery.com " target="_blank"><img class="alignnone size-full wp-image-7947" title="" src="http://superdit.com/wp-content/uploads/2011/08/08.png" alt="" width="489" height="331" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/08/07/8-javascript-mobile-web-image-gallery-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter Layout Library For Autoload Frequently Used Views</title>
		<link>http://superdit.com/2011/05/02/codeigniter-layout-library-for-autoload-frequently-used-views/</link>
		<comments>http://superdit.com/2011/05/02/codeigniter-layout-library-for-autoload-frequently-used-views/#comments</comments>
		<pubDate>Mon, 02 May 2011 02:33:54 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[library]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=6399</guid>
		<description><![CDATA[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 Or<a href="http://superdit.com/2011/05/02/codeigniter-layout-library-for-autoload-frequently-used-views/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>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</p>
<pre class="brush: php; title: ; notranslate">
$data['page_title'] = 'Your title';
$this-&gt;load-&gt;view('header');
$this-&gt;load-&gt;view('menu');
$this-&gt;load-&gt;view('content', $data);
$this-&gt;load-&gt;view('footer');
</pre>
<p>Or the worse before this sometimes I include the <em>header </em>and <em>footer </em>directly on the view file, well these method really wasting time, an make the code on the views not really well organized.<span id="more-6399"></span></p>
<p>This post is my little idea to automatically load most used layout part in Codeigniter using our custom library, Lets get through the code, first create a library file in <em>application/libraries/</em> for example <strong>My_Layout.php</strong>, and these all the code for the library</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class MY_Layout extends CI_Controller {

    public $header = 'header';
    public $footer = 'footer';

    public function content($views = '', $data = '')
    {
        // load header
        if ($this-&gt;header)
        {
            $this-&gt;load-&gt;view($this-&gt;header, $data);
            $data = '';
        }

        // load content, can be more than one views
        if (is_array($views))
        {
            foreach ($views as $view)
            {
                $this-&gt;load-&gt;view($view, $data);
                $data = '';
            }
        }
        else
        {
            $this-&gt;load-&gt;view($views, $data);
        }

        // load footer
        if ($this-&gt;footer)
        {
            $this-&gt;load-&gt;view($this-&gt;footer);
        }
    }
}
</pre>
<p>Basically this library just manipulating the default view function, I set <em>$header</em> and <em>$footer</em> attributes as values that most common used name, but you can change it on the fly, the content function load three main view, first the header, we can set the header to FALSE if do not wan to load it, and if the header load first the dynamic data that came from controller, loaded too, in case we need a dynamic data on the header. Second, the content, this section can be consist more than one views, and the last is footer, similar to header it can be loaded or not.</p>
<p><strong>Sample Usage</strong></p>
<p>This is the sample usage in controller, using single view.<strong><br />
</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class User extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this-&gt;load-&gt;library('MY_Layout');
    }

    public function test()
    {
        $data['title'] = 'dynamic_string';

        $this-&gt;my_layout-&gt;content('user/test', $data);
    }
}
</pre>
<p><strong>Using More Than One Views</strong></p>
<p>To use two or more layout you can assign the views as array</p>
<pre class="brush: php; title: ; notranslate">
$data['title'] = 'dynamic_string';
$views = array(
    'menu' =&gt; 'menu',
    'content' =&gt; 'user/test'
);

$this-&gt;my_layout-&gt;content($views, $data);
</pre>
<p><strong>Header &amp; Footer</strong></p>
<p>You can set your own header and footer by directly set the its properties, to your header value, or maybe just set to FALSE to turn the header or footer off.</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;my_layout-&gt;header = 'user/custom_user_header';
// or turn off header
$this-&gt;my_layout-&gt;header = FALSE;
</pre>
<p>That&#8217;s all hope that can give you some idea to start with, or maybe you can give some more features to this library to make it better, and easy to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/05/02/codeigniter-layout-library-for-autoload-frequently-used-views/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Creating user session checking with CodeIgniter library</title>
		<link>http://superdit.com/2010/04/17/creating-user-session-checking-with-codeigniter-library/</link>
		<comments>http://superdit.com/2010/04/17/creating-user-session-checking-with-codeigniter-library/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 12:19:08 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=351</guid>
		<description><![CDATA[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<a href="http://superdit.com/2010/04/17/creating-user-session-checking-with-codeigniter-library/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>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 <a title="CodeIgniter" href="http://codeigniter.com" target="_blank">Codeigniter</a>, using <a title="CodeIgniter Session Class" href="http://codeigniter.com/user_guide/libraries/sessions.html" target="_blank">Session Class</a> you can use simple function inside controller, it&#8217;s something like this:</p>
<pre class="brush: php; title: ; notranslate">
class User extends Controller {

	// constructor class
	function __construct()
	{
		parent::Controller();
		$this-&gt;load-&gt;library('session');
	}

	function index()
	{
		$this-&gt;load-&gt;view('user/index');
	}

	function login()
	{
		// if user already logged in, redirect to user index
		if ($this-&gt;_is_logged_in())
		{
			redirect('user/index');
		}
		else
		{
			$this-&gt;load-&gt;view('user/login');
		}
	}

	function register()
	{
		// if user already logged in, redirect to user index
		if ($this-&gt;_is_logged_in())
		{
			redirect('user/index');
		}
		else
		{
			$this-&gt;load-&gt;view('user/register');
		}
	}

	// checking user logged user by registered session
	function _is_logged_in()
	{
		$logged = $this-&gt;session-&gt;userdata('user_id');
		if ($logged)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
}
</pre>
<p><span id="more-351"></span></p>
<p>The problem using that method is when we have multiple controller using the same function, we have to write the same code again and again, uh that&#8217;s painfull, <a title="Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels" href="http://www.codinghorror.com/blog/2009/02/dont-reinvent-the-wheel-unless-you-plan-on-learning-more-about-wheels.html" target="_blank">this post have simple answer</a>. Another solution is creating that user session checking function in model class, but when we create a class model in CodeIgniter we must extends CI Model Class and I don&#8217;t think we need to extends the CI Model Class, so I create my own user session library, and here it goes:</p>
<p>Create a php file named <em>MY_Usession.php</em> in folder <em>application/libraries/</em>, Insert this code and save it:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Usession extends CI_Session {

    public $logged_in = FALSE;

    public function  __construct() {
        parent::CI_Session();
        $this-&gt;is_logged_in();
    }

    public function is_logged_in()
    {
        $logged = $this-&gt;userdata('user_id');
        $this-&gt;logged_in = ($logged) ? TRUE : FALSE;
    }
}
</pre>
<p>Open file <em>application/config/autoload.php</em> add the library to the <em>$autoload["libraries"]</em> variable, it may something like this</p>
<pre class="brush: php; title: ; notranslate">
$autoload['libraries'] = array('database', 'session', 'my_usession');
</pre>
<p>Yup now all set, when we load every controller, the MY_Usession library will check whether the user is logged in or not, and you can access it in Controller or in a View by calling it&#8217;s property</p>
<pre class="brush: php; title: ; notranslate">
$this-&gt;my_usession-&gt;logged_in
</pre>
<p>For example using in Controller:</p>
<pre class="brush: php; title: ; notranslate">
class User extends Controller {

	// constructor class
	function __construct()
	{
		parent::Controller();
		$this-&gt;load-&gt;library('session');
	}

	function index()
	{
		$this-&gt;load-&gt;view('user/index');
	}

	function login()
	{
		// if user already logged in, redirect to user index
		if ($this-&gt;my_usession-&gt;logged_in)
		{
			redirect('user/index');
		}
		else
		{
			$this-&gt;load-&gt;view('user/login');
		}
	}

	function register()
	{
		// if user already logged in, redirect to user index
		if ($this-&gt;my_usession-&gt;logged_in)
		{
			redirect('user/index');
		}
		else
		{
			$this-&gt;load-&gt;view('user/register');
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/04/17/creating-user-session-checking-with-codeigniter-library/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

