<?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>Mahbubur Rahman - jQuery, PHP, JavaScript, Codeigniter, CSS &#187; Codeigniter</title>
	<atom:link href="http://www.mahbubblog.com/category/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mahbubblog.com</link>
	<description>PHP, JQUERY, JAVASCRIPT fun</description>
	<lastBuildDate>Thu, 03 Jun 2010 07:23:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Killing session on browser close in Codeigniter</title>
		<link>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:41:06 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[browser close]]></category>
		<category><![CDATA[codeigniter session]]></category>
		<category><![CDATA[session killing]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=203</guid>
		<description><![CDATA[It may be well known to some people how to kill sessions on browser close but the default config in codeigniter doesn&#8217;t provide so. In lot of application which has admin interface, we don&#8217;t want browser to store the session. So it needs to kill the session when browser is closed. Example behavior can be [...]]]></description>
			<content:encoded><![CDATA[<p>It may be well known to some people how to kill sessions on browser close but the default config in codeigniter doesn&#8217;t provide so. In lot of application which has admin interface, we don&#8217;t want browser to store the session. So it needs to kill the session when browser is closed. Example behavior can be found in yahoo email page.</p>
<p>So how do we do that in Codeigniter ? It&#8217;s simple, although this feature is not well commented or documented. Ok, now open system/application/config/config.php file</p>
<p>And find the settings called<strong> $config['sess_expiration'] </strong>unde<strong>r </strong>the section <strong>Session Variables </strong>and put the value like this</p>
<pre class="brush: php">

$config[&#039;sess_expiration&#039;]        = -1;
</pre>
<p>That&#8217;s it. Now your session will be killed in the event of browser closing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Form Validation Callbacks in HMVC in Codeigniter</title>
		<link>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:13:57 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[callbacks]]></category>
		<category><![CDATA[form validation]]></category>
		<category><![CDATA[hmvc]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=190</guid>
		<description><![CDATA[Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There&#8217;re 1 or two exceptions which i have found. One is the callback of Form_validation [...]]]></description>
			<content:encoded><![CDATA[<p>Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC</p>
<p>HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There&#8217;re 1 or two exceptions which i have found. One is the callback of Form_validation class. If we are making some forms like registration we check emails and usernames and we do it in the form validation class using callbacks. If we look at the basic callback structure when validating forms from CI documentation, it appears like.</p>
<pre class="brush: php">

&lt; ?php

class Form extends Controller
{

 function index()
 {
 $this-&gt;load-&gt;helper( array (

 &#039;form&#039;,
 &#039;url&#039;
 ) );

 $this-&gt;load-&gt;library( &#039;form_validation&#039; );

 $this-&gt;form_validation-&gt;set_rules( &#039;username&#039;, &#039;Username&#039;, &#039;callback_username_check&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;password&#039;, &#039;Password&#039;, &#039;required&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;passconf&#039;, &#039;Password Confirmation&#039;, &#039;required&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;email&#039;, &#039;Email&#039;, &#039;required&#039; );

 if ($this-&gt;form_validation-&gt;run() == FALSE)
 {
 $this-&gt;load-&gt;view( &#039;myform&#039; );
 }
 else
 {
 $this-&gt;load-&gt;view( &#039;formsuccess&#039; );
 }
 }

 function username_check($str)
 {
 if ($str == &#039;test&#039;)
 {
 $this-&gt;form_validation-&gt;set_message( &#039;username_check&#039;, &#039;The %s field can not be the word &quot;test&quot;&#039; );
 return FALSE;
 }
 else
 {
 return TRUE;
 }
 }

}
?&gt;
</pre>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><span style="color: #143270; white-space: pre-wrap;">But this callback will not simply work. Some of my precious hours went why it was not working. Then i navigated the Form_validation.php in /system/libraries folder around line 580 which looks like </span></span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><span style="color: #143270; white-space: pre-wrap;"><br />
</span></span></span></p>
<p><span style="color: #143270; font-family: 'Lucida Grande'; font-size: 14px; white-space: pre-wrap;"> </span></p>
<pre class="brush: php">
if ($callback === TRUE)
 {
 if ( ! method_exists($this-&gt;CI, $rule))
 {
 continue;
 }
</pre>
<p><span style="font-size: small;"><span style="color: #143270; font-family: 'Lucida Grande'; white-space: pre-wrap;"><span style="font-family: verdana,geneva;">The function &#8211; <strong>method_exists</strong> returns false even if the callback function is there in the Controller and after all in the CI loader object. So it came out from the forum that you have to do a little extension to Form Validation class which is </span></span></span></p>
<pre class="brush: php">
&lt; ?php if (!defined(&#039;BASEPATH&#039;)) exit(&#039;No direct script access allowed&#039;);

class MY_Form_validation extends CI_Form_validation
{
 function run($module = &#039;&#039;, $group = &#039;&#039;) {
 (is_object($module)) AND $this-&gt;CI =&amp; $module;
 return parent::run($group);
 }
}
/* End of file MY_Form_validation.php */
/* Location: ./application/libraries/MY_Form_validation.php */
</pre>
<p>And when running the validation like in earlier code</p>
<pre class="php"> if ($this-&gt;form_validation-&gt;run() == FALSE)</pre>
<p>you have to provide an addition $this as a parameter to run method. which will look like</p>
<pre class="php"> if ($this-&gt;form_validation-&gt;run(<strong>$this</strong>) == FALSE)</pre>
<p>Now, you validation callbacks will work perfectly.</p>
<p>Another note, if you&#8217;re trying to access a public variable of a controller via the get_instance() in hooks , you&#8217;ll have to write in your controller like this.</p>
<p>CI::instance()-&gt;var_name = &#8220;Some Value&#8221;;</p>
<p>May be there are some other required adjustments when using HMVC, but i came across this two time killing adjustments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Python for Codeigniter developers</title>
		<link>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/</link>
		<comments>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 07:00:15 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[web2py]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=178</guid>
		<description><![CDATA[So, you use codeigniter and  want to develop something in python ? And you have following things in mind : 1. An MVC framework which has almost zero installation. 2. A framework that behaves quite in the same fashion like Codeigniter. 3. Small footprint 4. Has Similar or even easier libraries than codeigniter. 5. And [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.python.org/images/python-logo.gif" alt="" width="211" height="71" /></p>
<p>So, you use codeigniter and  want to develop something in python ? And you have following things in mind :</p>
<p>1. An MVC framework which has almost zero installation.</p>
<p>2. A framework that behaves quite in the same fashion like Codeigniter.</p>
<p>3. Small footprint</p>
<p>4. Has Similar or even easier libraries than codeigniter.</p>
<p>5. And you want something which works both in Windows/mac/Linux.</p>
<p>You have probably heard of developing web apps using python and python frameworks like django. But the installation on your windows machine or linux machine along with apache is a big headache. You want something short and sweet, something works out of the box.</p>
<p>OKKEYS, the name is <a href="http://www.web2py.com/">web2py </a>- an enterprise web development framework &#8211; entirely written in python. If i start to write all good things about it, the post might become really big. So let&#8217;s jump into the installing of this framework and see some actions.</p>
<h2>Things needed</h2>
<p><a href="http://www.python.org/download/releases/2.5.2/">Python 2.5.2</a></p>
<p><a href="http://www.web2py.com/examples/static/web2py_src.zip">web2py Framework</a></p>
<h2>Steps :</h2>
<p><strong>1.</strong> For windows XP, install python 2.5.2 &#8211; the .msi package. It&#8217;ll probably install in your c:/Python25 directory. Now you have to add 2 environment variables.  Right click &#8220;My Computer&#8221; -&gt; Properties -&gt;Advanced -&gt; Environment Variables (at the bottom).  Under the &#8220;System Variables&#8221; double click &#8220;Path&#8221; and put ;C:\python25;C:\python25\scripts at end of the Variable Value.  For windows users, a restart is sometimes necessary to propagat</p>
<p>For Ubuntu, if you have already installed python latest version which is 3.X, you have to install python 2.5.2. They can run simultanously. So in terminal,</p>
<p>sudo apt-get install python2.5</p>
<p><strong>2.</strong> Unzip the folder from you have downloaded http://www.web2py.com/examples/static/web2py_src.zip to some place. May be c:/web2py or in Ubuntu /home/username/web2py [or anything you like ]</p>
<p><strong>3.</strong> Now it&#8217;s assumed that python runs from command prompt or terminal. To verify type python in command prompt in windows (not in CYGWIN or any Bash Shell) or in terminal in linux. If you get something like this</p>
<p><span style="font-family: courier new,courier;">Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on<br />
win32<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
&gt;&gt;&gt;</span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;">It means you have successfully installed python. Now from the command prompt go to your web2py directory using <strong>cd web2py</strong></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;"><strong>4.</strong><span style="font-family: verdana,geneva;"> TIME FOR ACTION!!! Now that you&#8217;re into the web2py directory,<strong> </strong>simply<strong> </strong>type </span></span></span></p>
<p><span style="font-family: courier new,courier;">python web2py.py</span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;">You&#8217;ll get a greeting screen and the a screen like this both in windows and linux.<br />
</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;"><br />
</span></span></p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/07/web2py_server.jpg"><img class="alignnone size-medium wp-image-180" title="web2py_server" src="http://www.mahbubblog.com/wp-content/uploads/2009/07/web2py_server-300x220.jpg" alt="web2py_server" width="300" height="220" /></a></p>
<p>It asks for an admin password. Choose anything simple for the time being and hit &#8220;Start Server&#8221;. That&#8217;s it. A window will open with the web2py admin panel like this.</p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/07/welcome_1247640873997.png"><img class="alignnone size-medium wp-image-181" title="welcome_1247640873997" src="http://www.mahbubblog.com/wp-content/uploads/2009/07/welcome_1247640873997-300x114.png" alt="welcome_1247640873997" width="300" height="114" /></a></p>
<p>Alright, from this point, i think you can start playing with the links and most of the options are self explanatory. Click the links, go deeper and have fun with an easy MVC framwork in Python.</p>
<p>Keep discovering!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upload all your files in lowercase in Codeigniter</title>
		<link>http://www.mahbubblog.com/php/upload-all-your-files-i-lowercase-in-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/upload-all-your-files-i-lowercase-in-codeigniter/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 08:12:04 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=130</guid>
		<description><![CDATA[You might all probably know that *nix systems treat myPic.jpg and MYpic.jpg different while windows systems don&#8217;t . So there&#8217;s always been a need to deal with filenames across different systems. We upload files which may be in lower case, uppercase or a mixture of both. This sometimes kills our valuable time and effort. To deal [...]]]></description>
			<content:encoded><![CDATA[<p>You might all probably know that *nix systems treat myPic.jpg and MYpic.jpg different while windows systems don&#8217;t . So there&#8217;s always been a need to deal with filenames across different systems. We upload files which may be in lower case, uppercase or a mixture of both. This sometimes kills our valuable time and effort. To deal with files uploading, edit and delete if we always assume that file names are in lowercase, it&#8217;s lot better unless we have significant reasons to keep the case of the files intact.   Codeigniter has a good uploading library which resides at <strong>/system/libraries/Upload.php</strong>. But unfortunately there&#8217;s no property of the uploading class that lets us to upload the file in lower case. So, the shortcut is to override the native method by your own library. When we initialize a library CI tries to find it within your application directory and then it&#8217;s System directory. So if we make a class <strong>MY_Upload </strong>extending <strong>CI_Upload</strong>, it can do the job. This is no trick, it&#8217;s documented on CI. So, now , we just need to override two functions in the <strong>CI_Upload</strong> class. These are <strong>_prep_filename </strong>and <strong>get_extension</strong> Here is how it looks</p>
<pre class="brush: php">

&lt; ?php
// For overriding Native class to  convert filenames to lowercase.
class MY_Upload extends CI_Upload
{
function _prep_filename($filename)
{
if (strpos($filename, &#039;.&#039;) === false)
{
return $filename;
}

$parts = explode(&#039;.&#039;, $filename);
$ext = array_pop($parts);
$filename = array_shift($parts);

foreach ($parts as $part)
{
if ($this-&gt;mimes_types(strtolower($part)) === false)
{
$filename .= &#039;.&#039; . $part . &#039;_&#039;;
}
else
{
$filename .= &#039;.&#039; . $part;
}
}

$filename .= &#039;.&#039; . $ext;

return strtolower($filename);
}
function get_extension($filename)
{
$x = explode(&#039;.&#039;, $filename);
return strtolower(&#039;.&#039;.end($x));
}
}
</pre>
<p>The code can be downloaded from here</p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/03/my_upload.zip">my_upload</a></p>
<p>Unzip and put it in your /system/application/libraries directory.</p>
<p>Now for any upload you do using CI&#8217;s uploading class, will produce lowercased filenames.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/upload-all-your-files-i-lowercase-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Is Kohana moving faster than Codeigniter ?</title>
		<link>http://www.mahbubblog.com/php/is-kohana-moving-faster-than-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/is-kohana-moving-faster-than-codeigniter/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 05:09:06 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[alexa]]></category>
		<category><![CDATA[beyondcoding]]></category>
		<category><![CDATA[kohanaphp]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=127</guid>
		<description><![CDATA[Look at the Alexa graph above. What do u think ? &#160; I&#8217;ve been using Codeigniter in Mid and Fairly Big project for over a year and a half. Kohana was released before i started but the amount of online support and tutorials and an active company development (EllisLab) made me decide using CodeIgniter. But [...]]]></description>
			<content:encoded><![CDATA[<a href="http://www.mahbubblog.com/wp-content/uploads/2009/03/ci-vs-kohana.jpg"><img alt="Traffic Codeigniter VS KohanaPHP" title="ci-vs-kohana" width="470" height="300" class="size-full wp-image-128" src="http://www.mahbubblog.com/wp-content/uploads/2009/03/ci-vs-kohana.jpg" /></a>
<p>Look at the Alexa graph above. What do u think ? &nbsp;</p>
<p>I&#8217;ve been using Codeigniter in Mid and Fairly Big project for over a year and a half. Kohana was released before i started but the amount of online support and tutorials and an active company development (EllisLab) made me decide using CodeIgniter. But I keep checking updates on Kohana because it has lot of extra features over CI. It&#8217;s Strictly PHP5 OOP and has libraries like ORM which doesn&#8217;t exist CI&#8217;s distribution. Just out of curiosity, i went to Alexa and compared the traffic for CI and KohanaPHP and it really surprised me. Kohana is way ahead in terms of traffic. What does that mean? People are more involved with Kohana than CI ? Well, apparently YES. Kohana is community driven development. In CI, user contributes as addons to the Framework, which is ok. But when there&#8217;s an active driving force by the community, it&#8217;s better, at least i think.&nbsp;</p>
<p>Moreover I read some articles how to easily use Zend in Kohana in the beyondcoding.com. So that makes me think of leaning towards Kohana for my next projects.&nbsp;There are of course ways to use CI with Zend though but the integration method of Kohana with Zend looked neat.&nbsp;It won&#8217;t get much tough to switch to Kohana because it was originally based on CI. And default design pattern in Kohana is Factory (as it appears) while CI is singleton. Of course I&#8217;ll need to analyze some more benchmarks for scalability and other features before shifting focus.&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/is-kohana-moving-faster-than-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
