<?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>Md Emran Hasan &#187; Code Igniter</title>
	<atom:link href="http://www.phpfour.com/blog/category/code-igniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpfour.com/blog</link>
	<description>Emran&#039;s sharing on web technologies</description>
	<lastBuildDate>Mon, 31 May 2010 03:23:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Changing the default controller naming convention in CodeIgniter</title>
		<link>http://www.phpfour.com/blog/2009/09/codeigniter-controller-naming-convention-modified/</link>
		<comments>http://www.phpfour.com/blog/2009/09/codeigniter-controller-naming-convention-modified/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 06:23:04 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[library]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=265</guid>
		<description><![CDATA[CodeIgniter is one of my favorite framework and I often use it for developing application quickly. Although it is very flexible in most cases, I find its naming convention to be strict. Many times I have faced this problem when my controller&#8217;s class name and a model/library&#8217;s class names are the same &#8211; a Fatal [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<p>CodeIgniter is one of my favorite framework and I often use it for developing application quickly. Although it is very flexible in most cases, I find its naming convention to be strict. Many times I have faced this problem when my controller&#8217;s class name and a model/library&#8217;s class names are the same &#8211; a Fatal error is inevitable and I have to forcefully change the name of the conflicting class to something less desirable (say from Users to UsersModel). Today I wanted to end this problem.</p>
<p>So I extended the <strong>CI_Router</strong> core class and made change to the <em>_validate_request</em> method. Now I can name my controller classes in this fashion: <strong>UsersController</strong> and it resides on the file system as <strong>controllers/UsersController.php</strong>. If you&#8217;ve tried other established frameworks, you should notice that this naming convention is widely used. So, if you have the same need, then just download the MY_Router.php file and put it on your application/libraries folder. That&#8217;s it.</p>
<p>Here is how your controller would start:</p>
<pre class="brush: php;">
&lt;?php

class UsersController extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }
}
</pre>
<p><span id="more-265"></span><br />
If you&#8217;d like to have a look at the code, here is the source for quick view:</p>
<pre class="brush: php;">
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
 * MY_Router
 *
 * Extended the core CI_Router class in order to force a different naming
 * convention for controllers.
 *
 */
class MY_Router extends CI_Router
{
    /*
     * Suffix in controller name
     *
     * @var String
     */
    private $_suffix = &quot;Controller&quot;;

    /*
     * Call the parent constructor
     *
     * This is a requirement for extending base CI core class. Just abiding by
     * the rules.
     *
     * @access  public
     * @return  void
     */
    public function MY_Router()
    {
        parent::CI_Router();
    }

    /**
     * Validates the supplied segments.  Attempts to determine the path to
     * the controller.
     *
     * @access   private
     * @param    array
     * @return   array
     */
    function _validate_request($segments)
    {
        // Retain the original segments
        $orgSegments = array_slice($segments, 0);

        // Add suffix to the end
        $segments[0] = ucfirst($segments[0]) . $this-&gt;_suffix;

        // Does the requested controller exist in the root folder?
        if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
        {
            return $segments;
        }

        // OK, revert to the original segment
        $segments[0] = $orgSegments[0];

        // Is the controller in a sub-folder?
        if (is_dir(APPPATH.'controllers/'.$segments[0]))
        {
            // Set the directory and remove it from the segment array
            $this-&gt;set_directory($segments[0]);
            $segments = array_slice($segments, 1);

            if (count($segments) &gt; 0)
            {
                // Add suffix to the end
                $segments[0] = ucfirst($segments[0]) . $this-&gt;_suffix;

                // Does the requested controller exist in the sub-folder?
                if ( ! file_exists(APPPATH.'controllers/'.$this-&gt;fetch_directory().$segments[0].EXT))
                {
                    show_404($this-&gt;fetch_directory().$segments[0]);
                }
            }
            else
            {
                // Add suffix to the end
                $this-&gt;default_controller = ucfirst($this-&gt;default_controller) . $this-&gt;_suffix;

                $this-&gt;set_class($this-&gt;default_controller);
                $this-&gt;set_method('index');

                // Does the default controller exist in the sub-folder?
                if ( ! file_exists(APPPATH.'controllers/'.$this-&gt;fetch_directory().$this-&gt;default_controller.EXT))
                {
                    $this-&gt;directory = '';
                    return array();
                }

            }

            return $segments;
        }

        // Can't find the requested controller...
        show_404($segments[0]);
    }
}
</pre>
<p>Cheers!</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;bodytext=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;selection=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;notes=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;t=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;annotation=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;title=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;body=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F09%2Fcodeigniter-controller-naming-convention-modified%2F&amp;t=Changing%20the%20default%20controller%20naming%20convention%20in%20CodeIgniter&amp;s=CodeIgniter%20is%20one%20of%20my%20favorite%20framework%20and%20I%20often%20use%20it%20for%20developing%20application%20quickly.%20Although%20it%20is%20very%20flexible%20in%20most%20cases%2C%20I%20find%20its%20naming%20convention%20to%20be%20strict.%20Many%20times%20I%20have%20faced%20this%20problem%20when%20my%20controller%27s%20class%20" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2009/09/codeigniter-controller-naming-convention-modified/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport)</title>
		<link>http://www.phpfour.com/blog/2009/02/updated-http-class-extended-model-codeigniter-cross-domain-ajax-php/</link>
		<comments>http://www.phpfour.com/blog/2009/02/updated-http-class-extended-model-codeigniter-cross-domain-ajax-php/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 21:27:47 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[essential]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=186</guid>
		<description><![CDATA[Greetings to all the readers of my blog. Many of you have been writing to me in the last couple days when I took the site down. The main objective was to add the new theme and push a few code updates of the existing libraries. I really appreciate your concern and would like to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<p>Greetings to all the readers of my blog. </p>
<p>Many of you have been writing to me in the last couple days when I took the site down. The main objective was to add the new theme and push a few code updates of the existing libraries. I really appreciate your concern and would like to reassure you that the site is up and will be up as usual <img src='http://www.phpfour.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Now, besides the slightly customized theme from Elegant Themes, I have put a few code updates. They are detailed below:</p>
<h3>Extended Model for CodeIgniter</h3>
<p>The <a href="http://www.phpfour.com/blog/2008/07/extended-model-for-codeigniter/">original version</a> of the Extended Model for CodeIgniter has been serving many people well. Although most users loved the nifty functions of the Model, many (including me) didn&#8217;t like the hacking of CI core to get this functionality. With the release of CodeIgniter 1.7, we can avoid that as we can now overload the Model class of CI like the other libraries. Follow this instruction:</p>
<p>1. Download the updated version from <a href="http://www.phpfour.com/blog/downloads/model-ci-2">here</a><br />
2. Put it in your application/libraries folder<br />
3. In your model files, use it this way: <strong>class Product extends MY_Model</strong><br />
4. Everything else is same just like the <a href="http://www.phpfour.com/blog/2008/07/extended-model-for-codeigniter/">original</a> one</p>
<h3>HTTP Class</h3>
<p>There is not much update in this class except for a few bug fixes (thanks to you guys). Also, I have included a license file in the package as many of you have asked. It&#8217;s released under the MIT license. The original post is <a href="http://www.phpfour.com/blog/2008/01/php-http-class/">here</a> for reference. </p>
<p>Download the update from <a href="http://www.phpfour.com/blog/downloads/http-class">here</a> and the API reference is <a href="http://www.phpfour.com/lib/http">here</a>.</p>
<h3>Cross-domain AJAX calls using PHP</h3>
<p>A minor bug fix in the code. Thanks to a few of you who pointed them out. Original post is <a href="http://www.phpfour.com/blog/2008/03/cross-domain-ajax-using-php/">here</a>. Download the update from <a href="http://www.phpfour.com/blog/downloads/transport">here</a>.</p>
<p>I have accelerated plans for the blog in 2009 so stay tuned for some worthy posts in this month. And do <a href="http://www.phpfour.com/blog/contact-me/">write to me</a> if you feel you have any questions/ideas/suggestions.</p>
<p>Cheers!</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;bodytext=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;selection=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;notes=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;t=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;annotation=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;title=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;body=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2009%2F02%2Fupdated-http-class-extended-model-codeigniter-cross-domain-ajax-php%2F&amp;t=Code%20Updates%20%28HTTP%20class%2C%20Extended%20CodeIgniter%20Model%2C%20Cross-domain%20AJAX%20transport%29&amp;s=Greetings%20to%20all%20the%20readers%20of%20my%20blog.%20%0D%0A%0D%0AMany%20of%20you%20have%20been%20writing%20to%20me%20in%20the%20last%20couple%20days%20when%20I%20took%20the%20site%20down.%20The%20main%20objective%20was%20to%20add%20the%20new%20theme%20and%20push%20a%20few%20code%20updates%20of%20the%20existing%20libraries.%20I%20really%20appreciate" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2009/02/updated-http-class-extended-model-codeigniter-cross-domain-ajax-php/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Becoming a Kick-ass PHP ninja</title>
		<link>http://www.phpfour.com/blog/2008/10/become-kick-ass-php-ninja-from-newbie-guide-tips/</link>
		<comments>http://www.phpfour.com/blog/2008/10/become-kick-ass-php-ninja-from-newbie-guide-tips/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 21:35:53 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Cake PHP]]></category>
		<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RBS]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[employment]]></category>
		<category><![CDATA[essential]]></category>
		<category><![CDATA[guideline]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[kick-ass]]></category>
		<category><![CDATA[php ninja]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=106</guid>
		<description><![CDATA[Who is this for? You&#8217;ve been developing web applications using PHP for a couple months now and are finding it very enjoyable. Although you feel that you&#8217;re doing quite good, you&#8217;re not sure whether its the end. Besides, the following questions wonder you often: Where to go from here What new things to learn How [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<h3>Who is this for?</h3>
<p>You&#8217;ve been developing web applications using PHP for a couple months now and are finding it very enjoyable. Although you feel that you&#8217;re doing quite good, you&#8217;re not sure whether its the end. Besides, the following questions wonder you often:</p>
<ul>
<li>Where to go from here</li>
<li>What new things to learn</li>
<li>How to become a Kick-ass PHP Ninja</li>
</ul>
<p>If that&#8217;s the scenario, then this post if for <strong>YOU</strong>.</p>
<h3>Background</h3>
<p>A few days back, I read a number of blog <a href="http://inter-sections.net/2007/11/13/how-to-recognise-a-good-programmer">posts</a> where people have highlighted the <a href="http://hasin.wordpress.com/2008/04/30/signs-you-are-ruining-your-career-as-a-web-app-developer/">shortcomings</a> they see in newbie developers. Some of them have gone further to narrow down the focus on <a href="http://www.boringguys.com/2008/05/20/beware-the-lone-wolf-php-developer/">PHP developers only</a> (as PHP&#8217;s nature sometimes allow developers to avoid standards). They did a great job by listing the shortcomings, but their posts missed clear way forwards (these can be inferred though). A number of readers also commented on the posts with their insight as well. So I was thinking how about compiling all these in an easy to follow list? Hence this post.</p>
<p>Btw, due to the volume, I&#8217;ve mostly touched the points here and provided few useful resource links for further study. I do have plan to elaborate a few of them in coming posts, with each point becoming a single post. Let me know which ones you&#8217;ll prefer most, by entering the poll at the bottom of the post.</p>
<h3>Part A : Technical Way Forward</h3>
<p>In the first part, let&#8217;s shed some light on how you can move forward with your technical abilities.</p>
<p><strong>1. Start using version control</strong></p>
<p>Version control is like a big UNDO button for your coding. You can go back to your previous code revisions and can compare/rollback to specific code areas anytime you see necessary. It will keep track of all your changes and will empower you to track your development changes across your work/team. Also, in a distributed development team, version control helps prevent overwriting of code by team members and keeps all the members code up to date.</p>
<p><a href="http://subversion.tigris.org">Subversion (SVN)</a> is one of the most popular open source version control system. If you&#8217;re on windows platform, you can try <a href="http://tortoisesvn.net">TortoiseSVN</a>, a client for SVN.</p>
<p><strong>2. Write code in OOP way</strong></p>
<p>If you haven&#8217;t already, it&#8217;s high time you started writing code in Object Oriented Programming (OOP) way. You may ask why? Well, OOP forces you to write code that is maintainable in nature. If properly followed, OOP code become a lot efficient than procedural code. Also, it allows you to re-use code across your project and/or multiple projects.</p>
<p>If you&#8217;re not convinced, have a <a href="http://www.phpdeveloper.org/news/5719">look</a> at <a href="http://www.php.net/oop">these</a> excellent <a href="http://www.killerphp.com/tutorials/object-oriented-php/">resources</a> for further study.</p>
<p><strong>3. Adhere to a coding standard</strong></p>
<p>Coding standards allow you to write code in a way which is easily understood by other people. When you adhere to a coding standard used by may others, you actually convey a message that you&#8217;re serious in writing code that people will be able to &#8220;get&#8221; and maintain. Keeping abbreviation type variable names, applying multiple indention types, writing meaningless function names etc will work for you in short term, maybe in personal projects. But when you move to a larger group with a number of developers, you ought to follow a standard so that everybody working with you can get along with your parts.</p>
<p>The following standards are most widely used among PHP developers around the globe:</p>
<ul>
<li><a href="http://pear.php.net/manual/en/standards.php">PEAR Coding Standards</a></li>
<li><a href="http://framework.zend.com/manual/en/coding-standard.html">Zend Framework Coding Standards</a></li>
<li><a href="http://ez.no/ezpublish/documentation/development/standards/php">eZ Publish PHP Coding Standards (depreciated)</a></li>
<li><a href="http://www.ezcomponents.org/contributing/coding_standards">eZ Components Implementation guidelines</a></li>
</ul>
<p>Although you can define a standard for your team/company, it&#8217;s always better to have close relation with what the industry follows. In my company, Right Brain Solution Ltd, we follow a slightly modified version of Zend Framework Coding Standards. You can get that one <a href="http://www.rightbrainsolution.com/php_coding_standard_rbs.pdf">here</a>.</p>
<p><strong>4. Document your code</strong></p>
<p>Documentation is a virtue of great developers &#8211; don&#8217;t get me wrong, I&#8217;m talking about code documentation, not writing user manuals <img src='http://www.phpfour.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Well documented code prevents other team members from reading each line of your code and understand them by heart. Rather, it tells them exactly what they need to know &#8211; purpose of the code, what it requires as input, what it will deliver as output, etc. If you take a look at the above mentioned coding standards, you&#8217;ll discover that most of them even specified standard for documentation as well, which is <a href="http://www.phpdoc.org/">phpDocumentor</a>. It&#8217;s the most used standard for PHP code documentation and is widely recognized.</p>
<p><strong>5. Use a good framework</strong></p>
<p>Frameworks give you good structure and helps you build web applications in a fast way, with confidence. Most of today&#8217;s popular PHP frameworks (<a href="http://framework.zend.com/">Zend Framework</a>, <a href="http://www.codeigniter.com/">CodeIgniter</a>, <a href="http://cakephp.org/">CakePHP</a>, <a href="http://www.symfony-project.org">Symfony</a>, <a href="http://kohanaphp.com">Kohana</a> etc) follow the Model-View-Controller (MVC) pattern, which itself is a strong advocate of good practice.</p>
<p>Besides structure, frameworks force you to write code in a structured way. Some of them will also require writing the code in OOP &#8211; whose benefit we already discussed above. And frameworks usually come with a number of helpful libraries and helpers, to make your life easy as a web developer.</p>
<p>Josh sharp discusses this in details <a href="http://joshsharp.com.au/blog/view/why_you_should_be_using_a_framework">here </a>and later posts a follow-up <a href="http://joshsharp.com.au/blog/view/perhaps_the_world_doesnt_need_another_framework">here</a>. Both are good reads.</p>
<p><strong>6. Re-use code/libraries</strong></p>
<p>One of the most common advice programmers get is: &#8220;Don&#8217;t re-invent the wheel&#8221;. Well, what&#8217;s the point here? It actually means that you should not spend much time on solving a problem that has already been solved, in efficient way, by others. Rather solving it out yourself, you can &#8220;google&#8221; it and see how others have done it. It will not only save your valuable time, but also will ensure stable code (assuming that people usually post things on web after doing a number of testing and user of the codes usually help iron-out any issues, etc).</p>
<p>However, keep an eye on your target use/objective. If there is not enough good solutions that solves your problem, go ahead and solve yourself. Make it good and give it back to the community so that others facing that problem won&#8217;t need to spent the time you&#8217;ve spent. The whole open source model runs on this give-give way, so be a part of it.</p>
<p><strong>7. Test your code the right way</strong></p>
<p>In order to make confidence out of your code, you&#8217;ll need to test your code the right way. Although you might be used to testing your application using debug messages and browser refreshes, in a real world scenario these won&#8217;t work. You&#8217;ll need to write unit tests which can do automated testing of your code. The power lies in that you can run these tests almost anytime and can check if anything is broken after each new change.</p>
<p><a href="http://www.phpunit.de/">PHPUnit</a> and <a href="http://www.simpletest.org/">SimpleTest</a> are the two most widely used Unit testing suite for PHP. You should also have a look on <a href="http://en.wikipedia.org/wiki/Test-driven_development">Test Driven Development (TDD)</a>, which is the way of greatly enhancing your chance of deploying application with least bugs.</p>
<h3>Part B : Personal Way Forward</h3>
<p>Now, even if you&#8217;ve improved yourself on the above mentioned points, you&#8217;ll still need to work on your personal matters to move forward. Here goes those points.</p>
<p><strong>8. Be Agile</strong></p>
<p>You need to be an agile developer if you want to move forward in your career. What does it mean to be agile? Agility is more of an attitude than a skill set. The common characteristics of agile developers are:</p>
<ul>
<li>They’re open minded and therefore willing to learn new techniques</li>
<li>They’re responsible and therefore willing to seek the help of the right person(s) for the task at hand</li>
<li>They&#8217;re willing to work closely with others, pair programming or working in small teams as appropriate</li>
<li>They&#8217;re willing to work iteratively and incrementally</li>
</ul>
<p>Further resources: <a href="http://en.wikipedia.org/wiki/Agile_software_development">Agile Software Development</a>, <a href="http://agilemanifesto.org/">The Agile Manifesto</a>.</p>
<p><strong>9. Keep yourself updated</strong></p>
<p>No matter what, keep yourself updated on whats going on in your field (in this case PHP). Subscribe to the RSS of great PHP blogs and skim over them on a regular basis. Dig into the topics that interest you most and see the author&#8217;s point. Also, keep a habit of trying new technologies every now &#038; then. It gives you an edge over others and when any discussion goes about it, you can help others understand as well as make your points.</p>
<p>Btw, if you don&#8217;t have a clue where to find good blogs, have a look at <a href="http://planet-php.org/">here</a>, <a href="http://hasin.wordpress.com/2007/07/12/list-of-rss-feeds-i-read-almost-everyday/">here</a> and <a href="http://godbit.com/article/reading-list">here</a>.</p>
<p><strong>10. Start community involvement</strong></p>
<p>Remember I told above to give your work back to the community ? How to do that ? <a href="http://wordpress.com/">Start a blog</a> of your own and start writing posts there every now &#038; then. Yes, I know you&#8217;d say &#8220;Who&#8217;s going to read my blog anyway?&#8221;, but if you share your experience, someday, somebody will find it useful. And if you can share things that others haven&#8217;t done, you&#8217;ll slowly see visitors coming on your blog increasing way.</p>
<p>Besides blog, try to participate in tech <a href="http://www.sitepoint.com/forums/">forums</a> and <a href="http://tech.groups.yahoo.com/group/phpexperts">communities</a>. Help people out in the areas you excel and at the time of your need, other people will be happy to help you out as well. These communities are also great place to learn about many unusual matters, see how situation changes from person to person, place to place, etc. You&#8217;ll also be able to make great friends who might come handy later in your life.</p>
<p>Another great way of community involvement is to contributing to <a href="https://www.ohloh.net/projects">open source projects</a>. Share some of your valuable time for an open source project and it may come handy for a huge number of people. Your work might solve the problem of somebody like you. If needed, <a href="http://www.orchidframework.com/">initiate</a> an open source project yourself and invite others to work on your vision.</p>
<p><strong>11. Use a good IDE</strong></p>
<p>With due respect to <a href="http://www.adobe.com/products/dreamweaver/">Dreamweaver</a>, step forward and use an IDE made for PHP. You&#8217;ll notice the difference in a few days when you&#8217;ll see that your productivity has increased in great ways. These IDEs provide great number of useful features including but not limited to: syntax highlighting, auto completion, code suggestions, code snippets, contextual help, code templates, debugging, profiling, etc.</p>
<p>The following IDEs mostly have the similar feature set and can boost your productivity in great ways:</p>
<ul>
<li><a href="http://www.nusphere.com/products/phped.htm">NuSphere PhpED</a></li>
<li><a href="http://www.mpsoftware.dk/">phpDesigner 2008</a></li>
<li><a href="http://www.zend.com/en/products/studio/">Zend Studio for Eclipse</a></li>
</ul>
<p>Personally I use <strong>NuSphere PhpED 5.2</strong> and I love it in every way. They&#8217;ve provided me with a complementary license and I am grateful to them for that. If you&#8217;re planning to buy it, let me know and I might find you a discount.</p>
<p><strong>12. Be communicative</strong></p>
<p>In your team/company, try to be as communicative as possible. It reduces a lot of confusions, makes you close to other devs so that you understand them, portrays you as a good person in front of management and overall, helps you enjoy your work. When you&#8217;re working together with others, make them feel that you&#8217;re there and ready to give whatever it takes. Create a personal brand of yourself.</p>
<h3>What&#8217;s next?</h3>
<p>Phew! It&#8217;s quite a good amount of writing in a while <img src='http://www.phpfour.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;ve tried to cover most of the items I found to be important. However, there might be some points I&#8217;ve overlooked so feel free to post them in the comments. If this helps any one of the developers I intend it for, then I&#8217;ll take that the effort is successful.</p>
<p>Thanks everybody, Happy Eid Mubarak to you!</p>
<div style="background-color: #EAF3FA;border: 1px solid #464646;">Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.</div>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;bodytext=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Becoming%20a%20Kick-ass%20PHP%20ninja%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;selection=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;notes=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;t=Becoming%20a%20Kick-ass%20PHP%20ninja" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;annotation=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;title=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;body=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F10%2Fbecome-kick-ass-php-ninja-from-newbie-guide-tips%2F&amp;t=Becoming%20a%20Kick-ass%20PHP%20ninja&amp;s=Who%20is%20this%20for%3F%0A%0AYou%27ve%20been%20developing%20web%20applications%20using%20PHP%20for%20a%20couple%20months%20now%20and%20are%20finding%20it%20very%20enjoyable.%20Although%20you%20feel%20that%20you%27re%20doing%20quite%20good%2C%20you%27re%20not%20sure%20whether%20its%20the%20end.%20Besides%2C%20the%20following%20questions%20wonde" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2008/10/become-kick-ass-php-ninja-from-newbie-guide-tips/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Extended Model for CodeIgniter</title>
		<link>http://www.phpfour.com/blog/2008/07/extended-model-for-codeigniter/</link>
		<comments>http://www.phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 20:59:03 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RBS]]></category>
		<category><![CDATA[class]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104</guid>
		<description><![CDATA[Feb 2009: An updated version of the code for CodeIgniter 1.7.x can be found here. I developed this extension of CodeIgniter&#8217;s Model last year, but never had the chance to publish it. The main purpose of this extension is to make a dev&#8217;s life easy. This extension has been used by several of my devs [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<blockquote class="left"><p><strong>Feb 2009: An updated version of the code for CodeIgniter 1.7.x can be found</strong> <a href="http://www.phpfour.com/blog/2009/02/updated-http-class-extended-model-codeigniter-cross-domain-ajax-php/">here</a>.
</p></blockquote>
<p>I developed this extension of CodeIgniter&#8217;s Model last year, but never had the chance to publish it. The main purpose of this extension is to make a dev&#8217;s life easy. This extension has been used by several of my devs at <a target="_blank" href="http://www.rightbrainsolution.com" title="Download Model">RBS</a> and has been proved to increase productivity and reduce the number of painful small queries to write. Their enthusiasm has driven me to post this for the CI fans out there.</p>
<p>Without much babble, let&#8217;s get into point. I&#8217;ve explained the process of installing it and then showed some example uses. For starter, click <a target="_blank" href="http://www.phpfour.com/blog/downloads/model-ci" title="Download Model">here</a> to download it. Now follow these steps to get started:</p>
<p><span id="more-104"></span></p>
<p>1. Replace the system/libraries/Model.php file with the attached Model.php (CodeIgniter version 1.6.3)</p>
<p>2. For each of your tables, you will need to create a model file in system/application/models. </p>
<p>3. Lets say we have a &quot;products&quot; table whose schema is as follows:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">CREATE</span> <span style="color: #0000ff">TABLE</span> `products` (</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>       `id` <span style="color: #0000ff">int</span>(11) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span> auto_increment,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>       `title` <span style="color: #0000ff">varchar</span>(50) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>       `description` text <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>       `color` <span style="color: #0000ff">varchar</span>(20) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>       `price` <span style="color: #0000ff">float</span> <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>       `category_id` <span style="color: #0000ff">int</span>(11) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>       `featured` <span style="color: #0000ff">char</span>(1) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>       `enabled` <span style="color: #0000ff">char</span>(1) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>       `visits` <span style="color: #0000ff">int</span>(1) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>       `created` <span style="color: #0000ff">int</span>(11) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>       `modified` <span style="color: #0000ff">int</span>(11) <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">NULL</span>,</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span>       <span style="color: #0000ff">PRIMARY</span> <span style="color: #0000ff">KEY</span>  (`id`)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     ) ENGINE=MyISAM;</pre>
</p></div>
</div>
<p>4. Now we need to create system/application/models/product.php:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> &lt;?php  <span style="color: #0000ff">if</span> (!defined(<span style="color: #006080">'BASEPATH'</span>)) exit(<span style="color: #006080">'No direct script access allowed'</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">class</span> Product extends Model {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>         function Product()</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>             <span style="color: #008000">// Call the Model constructor</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>             parent::Model();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>             </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>             <span style="color: #008000">// Load the associated table</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>             $<span style="color: #0000ff">this</span>-&gt;loadTable(<span style="color: #006080">'products'</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     }</pre>
</p></div>
</div>
<p>5. From any controller, you can load the Model as instructed in the CI manual. Here are some sample usage of the model functions:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> function products()</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>     {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>         <span style="color: #008000">// Load the model in the default way</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>         $<span style="color: #0000ff">this</span>-&gt;load-&gt;model(<span style="color: #006080">'Product'</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         <span style="color: #008000">// Total # of products</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>         echo $<span style="color: #0000ff">this</span>-&gt;Product-&gt;findCount();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>         <span style="color: #008000">// Total # of featured products</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>         echo $<span style="color: #0000ff">this</span>-&gt;Product-&gt;findCount(<span style="color: #006080">&quot;featured = 'Y'&quot;</span>); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>         <span style="color: #008000">// Retrieve ALL the products</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span>         $allProducts = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;findAll(); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>         <span style="color: #008000">// Retrive id, title and price of top 10 products (based on popularity) that are enabled</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>         $topProducts = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;findAll(<span style="color: #006080">&quot;enabled = 'Y'&quot;</span>, <span style="color: #006080">'id, title, price'</span>, <span style="color: #006080">'visits DESC'</span>, <span style="color: #006080">'0'</span>, <span style="color: #006080">'10'</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>         <span style="color: #008000">// Retrive id, title and price of the 1st most popular product that is enabled</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>         $topProducts = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;find(<span style="color: #006080">&quot;enabled = 'Y'&quot;</span>, <span style="color: #006080">'id, title, price'</span>, <span style="color: #006080">'visits DESC'</span>, <span style="color: #006080">'0'</span>, <span style="color: #006080">'10'</span>); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>         <span style="color: #008000">// Retrieve the product with id = 1</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>         $oneProduct = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;read(1); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span>         <span style="color: #008000">// Retrive the price of the product whose id = 1</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  25:</span>         $productPrice = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;field(<span style="color: #006080">'price'</span>, <span style="color: #006080">'id = 1'</span>); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  27:</span>         <span style="color: #008000">// Single array with the titles of all the enabled products</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span>         $productArr = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;generateSingleArray(<span style="color: #006080">&quot;enabled = 'Y'&quot;</span>, <span style="color: #006080">'title'</span>); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  29:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span>         <span style="color: #008000">// Insert a new product in the db</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  31:</span>         $newProductId = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;insert(array(<span style="color: #006080">'title'</span> =&gt; <span style="color: #006080">'New Product'</span>, <span style="color: #006080">'price'</span> =&gt; <span style="color: #006080">'10.99'</span>)); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  32:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  33:</span>         <span style="color: #008000">// Update the price of the newly added product</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  34:</span>         $updProduct = $<span style="color: #0000ff">this</span>-&gt;Product-&gt;save(array(<span style="color: #006080">'price'</span> =&gt; <span style="color: #006080">'20.00'</span>), $newProductId); </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  35:</span>         </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  36:</span>         <span style="color: #008000">// Delete the product</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  37:</span>         $<span style="color: #0000ff">this</span>-&gt;Product-&gt;remove($new_product_id);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  38:</span>     }</pre>
</p></div>
</div>
<p>7. There are a number of other helpful functions in this file. If you have a careful look, you&#8217;ll discover that some of them are really handy.</p>
<p>UPDATE: I forgot to give due credit to the wonderful developers of <a href="http://cakephp.org">CakePHP</a> &#8211; I&#8217;ve taken inspiration from their Model implementation while building this one for CodeIgniter. </p>
<h3>Download</h3>
<table cellspacing="0" cellpadding="2" border="0" width="698">
<tbody>
<tr>
<td width="42"><a target="_blank" href="http://www.phpfour.com/blog/downloads/model-ci" title="Download Model"><img src="http://www.phpfour.com/images/download.gif" border="0" /></a></td>
<td width="650"><strong>Model.php</strong><br/>Extended Model for CodeIgniter<br/>Downloaded: <strong>2738</strong> times</td>
</tr>
</tbody>
</table>
<p><strong>MORE UPDATE:</strong> Download the version for CodeIgniter 1.7.x <a href="http://www.phpfour.com/blog/2009/02/updated-http-class-extended-model-codeigniter-cross-domain-ajax-php/">here</a>.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;bodytext=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Extended%20Model%20for%20CodeIgniter%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;selection=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;notes=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;t=Extended%20Model%20for%20CodeIgniter" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;annotation=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;title=Extended%20Model%20for%20CodeIgniter&amp;body=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2008%2F07%2Fextended-model-for-codeigniter%2F&amp;t=Extended%20Model%20for%20CodeIgniter&amp;s=Feb%202009%3A%20An%20updated%20version%20of%20the%20code%20for%20CodeIgniter%201.7.x%20can%20be%20found%20here.%0D%0A%0D%0A%0D%0AI%20developed%20this%20extension%20of%20CodeIgniter%27s%20Model%20last%20year%2C%20but%20never%20had%20the%20chance%20to%20publish%20it.%20The%20main%20purpose%20of%20this%20extension%20is%20to%20make%20a%20dev%27s%20life%20eas" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2008/07/extended-model-for-codeigniter/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Htpasswd protection library for Code Igniter</title>
		<link>http://www.phpfour.com/blog/2007/07/htpasswd-protection-library-for-code-igniter/</link>
		<comments>http://www.phpfour.com/blog/2007/07/htpasswd-protection-library-for-code-igniter/#comments</comments>
		<pubDate>Mon, 23 Jul 2007 10:46:10 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/2007/07/23/htpasswd-protection-library-for-code-igniter/</guid>
		<description><![CDATA[This is a library designed to run with Code Igniter that allows the application to protect any folder in the webserver using the htpasswd method of Apache. It can also group the users and create group based permission on the folders. The use is very simple: you need to define an array of the users [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a library designed to run with <em>Code Igniter</em> that allows the application to protect any folder in the webserver using the <strong>htpasswd method</strong> of Apache. It can also group the users and create group based permission on the folders. The use is very simple: you need to define an array of the users (and array of groups if you need that), tell it where to store the password files and tell which folder to protect. It will do the rest for you. Here goes the function:</p>
<div style="background-color:#eeeeee; font-size:12px;">
<font face="Courier New"><font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">/**</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Protect&nbsp;a&nbsp;given&nbsp;folder&nbsp;with&nbsp;htpasswd&nbsp;protection&nbsp;method</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@author</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;Md&nbsp;Emran&nbsp;Hasan&nbsp;&lt;emran@rightbrainsolution.com&gt;</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@param</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;&nbsp;string&nbsp;&nbsp;location&nbsp;of&nbsp;the&nbsp;folder&nbsp;to&nbsp;protect</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@param</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;&nbsp;string&nbsp;&nbsp;location&nbsp;of&nbsp;the&nbsp;folder&nbsp;to&nbsp;write&nbsp;the&nbsp;group&nbsp;and&nbsp;password&nbsp;file</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@param</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;&nbsp;array&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;users&nbsp;info&nbsp;(username&nbsp;and&nbsp;password)</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@param</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;&nbsp;array&nbsp;&nbsp;&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;groups&nbsp;along&nbsp;with&nbsp;their&nbsp;user&nbsp;list</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@return</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;boolean</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></i><b><i><font color="#FF8000">@access</font></i></b><i><font color="#FF8000">&nbsp;&nbsp;public</font></i><br />
<i><font color="#FF8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">function</font></b><font color="#008080">&nbsp;</font><font color="#000000">protect</font>(<font color="#9D0000">$protectFolder</font><font color="#000000">,</font><font color="#008080">&nbsp;</font><font color="#9D0000">$passFolder</font><font color="#000000">,</font><font color="#008080">&nbsp;</font><font color="#9D0000">$userData</font><font color="#000000">,</font><font color="#008080">&nbsp;</font><font color="#9D0000">$groupData</font><font color="#008080">&nbsp;</font><font color="#000000">=</font><font color="#008080">&nbsp;</font><b><font color="#000000">array</font></b>())</font></p>
</div>
<p>It is a small part of the large protection library I have been developing for a membership management application called <strong>MemberSmart </strong>. This application allows someone to protect their PHP and non-PHP based files residing in a server in a number of ways. Among the methods, the htpasswd is the most easy and convenient one. This application will be released soon by the client I am working for.</p>
<p>Download the library with the example from <a href='http://www.phpfour.com/blog/wp-content/uploads/2007/07/htpasswd2.zip' title='htpasswd.zip'>htpasswd.zip</a>. Here is an example controller highlighting the use of the library.</p>
<div style="background-color:#eeeeee">
<font face="Courier New"><font size="2"><font color="#000000"><font color="#FF0000">&lt;?php<br />
</font><br />
<b><font color="#000000">class</font></b><font color="#008080">&nbsp;</font><font color="#000000">Protect</font><font color="#008080">&nbsp;</font><b><font color="#000000">extends</font></b><font color="#008080">&nbsp;</font><font color="#000000">Controller</font><font color="#008080">&nbsp;</font><font color="#000000">{<br />
</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">function</font></b><font color="#008080">&nbsp;</font><font color="#000000">Protect</font>()<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">{</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">parent</font>::Controller();<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">function</font></b><font color="#008080">&nbsp;</font><font color="#000000">index</font>()<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">{</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Load&nbsp;the&nbsp;library</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$this</font><font color="#000000">-&gt;</font>load-&gt;library(<font color="#008000">&#8216;AuthHtpasswd&#8217;</font><font color="#000000">);</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Create&nbsp;the&nbsp;user&nbsp;array&nbsp;(this&nbsp;might&nbsp;come&nbsp;from&nbsp;your&nbsp;db)</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$userData</font><font color="#008080">&nbsp;</font><font color="#000000">=</font><font color="#008080">&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;username&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;admin&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;password&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;root&#8217;</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">),</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;username&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;test&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;password&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;test123&#8242;</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">),</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;username&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;emran&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;password&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;hasan&#8217;</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">)</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">);<br />
</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Create&nbsp;the&nbsp;group&nbsp;array&nbsp;(this&nbsp;might&nbsp;also&nbsp;come&nbsp;from&nbsp;your&nbsp;db)</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$groupData</font><font color="#008080">&nbsp;</font><font color="#000000">=</font><font color="#008080">&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;name&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;ADMIN&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;users&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><b><font color="#000000">array</font></b>(<font color="#008000">&#8216;admin&#8217;</font><font color="#000000">,</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;emran&#8217;</font><font color="#000000">)</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">),</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">array</font></b>(<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;name&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;QA&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">&#8216;users&#8217;</font><font color="#008080">&nbsp;</font><font color="#000000">=&gt;</font><font color="#008080">&nbsp;</font><b><font color="#000000">array</font></b>(<font color="#008000">&#8216;test&#8217;</font><font color="#000000">)</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">)</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">);<br />
</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Define&nbsp;the&nbsp;root&nbsp;to&nbsp;the&nbsp;folders</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$rootDir</font><font color="#008080">&nbsp;</font><font color="#000000">=</font><font color="#008080">&nbsp;</font><font color="#9D0000">$_SERVER</font><font color="#000000">[</font><font color="#008000">'DOCUMENT_ROOT'</font><font color="#000000">]</font><font color="#008080">&nbsp;</font><font color="#000000">.</font><font color="#008080">&nbsp;</font><font color="#000000">DIRECTORY_SEPARATOR</font>;</p>
<p><font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Protect&nbsp;them!</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$action</font><font color="#008080">&nbsp;</font><font color="#000000">=</font><font color="#008080">&nbsp;</font><font color="#9D0000">$this</font><font color="#000000">-&gt;</font>authhtpasswd-&gt;protect(<font color="#9D0000">$rootDir</font><font color="#008080">&nbsp;</font><font color="#000000">.</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;cs&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$rootDir</font><font color="#008080">&nbsp;</font><font color="#000000">.</font><font color="#008080">&nbsp;</font><font color="#008000">&#8216;data&#8217;</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$userData</font><font color="#000000">,</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$groupData</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">);<br />
</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><i><font color="#FF8000">//&nbsp;Is&nbsp;there&nbsp;any&nbsp;error?&nbsp;If&nbsp;yes,&nbsp;then&nbsp;show&nbsp;them!</font></i><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><b><font color="#000000">if</font></b><font color="#008080">&nbsp;</font><font color="#000000">(!</font><font color="#9D0000">$action</font><font color="#000000">)</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">{</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#9D0000">$this</font><font color="#000000">-&gt;</font>authhtpasswd-&gt;printErrors();<br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#000000">}</font><br />
<font color="#FF0000">?&gt;</font></font></font></font>
</div>
<p><strong>Md Emran Hasan</strong><br />
Co-founder &#038; CTO<br />
<a href="http://www.rightbrainsolution.com">Right Brain Solution Ltd.</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;bodytext=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Htpasswd%20protection%20library%20for%20Code%20Igniter%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;selection=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;notes=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;t=Htpasswd%20protection%20library%20for%20Code%20Igniter" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;annotation=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;title=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;body=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2007%2F07%2Fhtpasswd-protection-library-for-code-igniter%2F&amp;t=Htpasswd%20protection%20library%20for%20Code%20Igniter&amp;s=This%20is%20a%20library%20designed%20to%20run%20with%20Code%20Igniter%20that%20allows%20the%20application%20to%20protect%20any%20folder%20in%20the%20webserver%20using%20the%20htpasswd%20method%20of%20Apache.%20It%20can%20also%20group%20the%20users%20and%20create%20group%20based%20permission%20on%20the%20folders.%20The%20use%20is%20very%20" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2007/07/htpasswd-protection-library-for-code-igniter/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Code Igniter Rocks !</title>
		<link>http://www.phpfour.com/blog/2006/06/code-igniter-rocks/</link>
		<comments>http://www.phpfour.com/blog/2006/06/code-igniter-rocks/#comments</comments>
		<pubDate>Fri, 09 Jun 2006 07:37:23 +0000</pubDate>
		<dc:creator>Emran Hasan</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phpfour.com/blog/2006/06/09/code-igniter-rocks/</guid>
		<description><![CDATA[A few days back I discovered CakePHP and was very impressed with it. I started to code one of my apps with it but my impression decreased when i wanted to deploy it. After several methods and even communicating in their IRC, I wasnt able to deploy the app &#8211; total wastage of my time [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;source=phpfour&amp;style=normal&amp;service=bit.ly&amp;service_api=R_fb1bb182101242116a43f27482aafdfc" height="61" width="50" /><br />
			</a>
		</div>
<p><img alt="Code Igniter " title="Code Igniter " src="http://www.codeigniter.com/images/design/ci_logo2.gif" /></p>
<p>A few days back I discovered CakePHP and was very impressed with it. I started to code one of my apps with it but my impression decreased when i wanted to deploy it. After several methods and even communicating in their IRC, I wasnt able to deploy the app &#8211; total wastage of my time !!!</p>
<p>My search for a framework thats as easy (or easier ?) as Cake but having smooth deploy feature started again. I heard about Code Igniter before, but didnt give it much attention. Now I decided to visit their site. The one thing that forced me to give attention to it this time was this text on their site:</p>
<p><em>&#8220;If you&#8217;re a developer who lives in the real world of shared hosting accounts and  clients with deadlines, and if you&#8217;re tired of ponderously large and thoroughly undocumented frameworks that require rocket science to understand, Code Igniter might just be the right tool for you.&#8221;</em></p>
<p>I decided to test it out and to my surprise, they are not lying a bit ! I was able to create a site for one client in super-cool way in a lot lesser time than it would actually take without it. While coding the app, I loved CI&#8217;s simplicity, its non-geeky style framework functions and their simple usages, the top-notch documentation and a good user base for knowledge searching.</p>
<p>Now I know which framework I should use for my projects. Certainly Cake is more robust framework than CI, but CI beats it by its simplicity. And I also love that !</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;bodytext=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="Digg"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21" title="DZone"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Code%20Igniter%20Rocks%20%21%20-%20http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F" title="Twitter"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;selection=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="Posterous"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21" title="Reddit"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;notes=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="del.icio.us"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21" title="StumbleUpon"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F" title="Technorati"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;t=Code%20Igniter%20Rocks%20%21" title="Facebook"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;annotation=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="Google Bookmarks"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;source=Md+Emran+Hasan+Emran%26%23039%3Bs+sharing+on+web+technologies&amp;summary=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="LinkedIn"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21" title="Simpy"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;title=Code%20Igniter%20Rocks%20%21&amp;body=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="Ping.fm"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.phpfour.com%2Fblog%2F2006%2F06%2Fcode-igniter-rocks%2F&amp;t=Code%20Igniter%20Rocks%20%21&amp;s=%0A%0AA%20few%20days%20back%20I%20discovered%20CakePHP%20and%20was%20very%20impressed%20with%20it.%20I%20started%20to%20code%20one%20of%20my%20apps%20with%20it%20but%20my%20impression%20decreased%20when%20i%20wanted%20to%20deploy%20it.%20After%20several%20methods%20and%20even%20communicating%20in%20their%20IRC%2C%20I%20wasnt%20able%20to%20deploy%20" title="Tumblr"><img src="http://www.phpfour.com/blog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.phpfour.com/blog/2006/06/code-igniter-rocks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
