<?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>itlivewire dev blog &#187; codeigniter</title>
	<atom:link href="http://itlivewire.com/devblog/category/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://itlivewire.com/devblog</link>
	<description>Just another web development blog...</description>
	<lastBuildDate>Mon, 16 Apr 2012 12:37:26 +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>hypenate function</title>
		<link>http://itlivewire.com/devblog/2011/01/16/hypenate-function/</link>
		<comments>http://itlivewire.com/devblog/2011/01/16/hypenate-function/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 10:37:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=385</guid>
		<description><![CDATA[The hypenated function helps you make a hypenated string. It replaces the spaces with a hypen (-), good for SEO and clean url string. Example: &#8220;Room nr IT Park and Country Mall&#8221; Becomes: &#8220;Room-nr-IT-Park-and-Country Mall&#8221; function hypenate($url){ $patterns[0]= &#34;/,/&#34;; $replacements[0]=&#34;&#34;; $patterns[1]=&#34;/\s\s+/&#34;; $replacements[1]=&#34;-&#34;; $url = preg_replace($patterns,$replacements,$url); return $url; } Usage in PHP hypenate(&#34;The quick brown fox&#34;); [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>hypenated</strong> function helps you make a <strong>hypenated string</strong>. </p>
<p>It replaces the spaces with a <strong>hypen (-)</strong>, good for SEO and clean url string.<br />
Example: &#8220;Room nr IT Park and Country Mall&#8221;<br />
Becomes: &#8220;Room-nr-IT-Park-and-Country Mall&#8221;</p>
<pre class="brush: php;">
function hypenate($url){
        $patterns[0]= &quot;/,/&quot;;
        $replacements[0]=&quot;&quot;;
        $patterns[1]=&quot;/\s\s+/&quot;;
        $replacements[1]=&quot;-&quot;;
        $url = preg_replace($patterns,$replacements,$url);
        return $url;
}
</pre>
<p>Usage in PHP</p>
<pre class="brush: php;">hypenate(&quot;The quick brown fox&quot;);</pre>
<p>output: The-quick-brown-fox</p>
<p>It can also remove out specific string you don&#8217;t want to show up on your url e.g. a <strong>comma &#8220;,&#8221;</strong>  just specify it on the <strong>patterns[0] array</strong> in regular expression form</p>
<pre class="brush: php;"> $patterns[0]= &quot;/,/&quot;;</pre>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2011/01/16/hypenate-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>codeigniter upload &#8220;The filetype you are attempting to upload is not allowed&#8221;</title>
		<link>http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-allowed/</link>
		<comments>http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-allowed/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 02:36:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=353</guid>
		<description><![CDATA[Error when uploading your file using codeigniter upload &#8220;The filetype you are attempting to upload is not allowed&#8221; Causes: 1. Invalid file type uploaded by the user your uploading (.doc when only .xls is allowed) 2. The file uploaded is not within the specified file types added in the upload config 3. Mime type error [...]]]></description>
			<content:encoded><![CDATA[<p>Error when uploading your file using codeigniter upload<br />
<strong>&#8220;The filetype you are attempting to upload is not allowed&#8221;</strong></p>
<p>Causes:</p>
<p>1. Invalid file type uploaded by the user your uploading (.doc when only .xls is allowed)<br />
2. The file uploaded is not within the specified file types added in the upload config<br />
3. Mime type error in codeigniter caused by the mime type of the extension does not match the mime type specified in <strong>/application/config/mimes.php</strong></p>
<p>Start by checking what is the mime type of the file your uploading </p>
<pre class="brush: php;">
$data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
$mimetype= $data['upload_data']['file_type'];
echo $mimetype;
</pre>
<p>then check in the mimes.php if that mime type matches the extension you want to upload</p>
<p>Example:<br />
word document</p>
<pre class="brush: php;">'doc'	=&gt;	'application/msword'</pre>
<p>excel file has many mime types, if its missing just add it in the array</p>
<pre class="brush: php;">'xls'	=&gt;	array('application/excel', 'application/vnd.ms-excel','application/x-msexcel')</pre>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2010/04/13/codeigniter-upload-the-filetype-you-are-attempting-to-upload-is-not-allowed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>codeigniter read or write a file</title>
		<link>http://itlivewire.com/devblog/2009/11/02/codeigniter-read-or-write-a-file/</link>
		<comments>http://itlivewire.com/devblog/2009/11/02/codeigniter-read-or-write-a-file/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 08:16:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://itlivewire.com/devblog/?p=163</guid>
		<description><![CDATA[In dealing with files on ci use the file helper http://codeigniter.com/user_guide/helpers/file_helper.html It is loaded using this line $this->load->helper(&#8216;file&#8217;); read a file with read_file() $data = read_file(&#8216;./path/to/file.php&#8217;); write a file with write_file(); write_file(&#8216;./path/to/file.php&#8217;, $data, &#8216;w+&#8217;); CI recommends &#8220;r+&#8221; but its better to use &#8220;w+&#8221;]]></description>
			<content:encoded><![CDATA[<p><img src="http://codeigniter.com/images/design/ci_logo2.gif" alt="" /></p>
<p>In dealing with files on ci use the <strong>file helper</strong><br />
<a href="http://codeigniter.com/user_guide/helpers/file_helper.html">http://codeigniter.com/user_guide/helpers/file_helper.html</a></p>
<p>It is loaded using this line<br />
$this->load->helper(&#8216;file&#8217;);<br />
<strong><br />
read a file with read_file()</strong><br />
$data = read_file(&#8216;./path/to/file.php&#8217;);</p>
<p><strong>write a file with write_file();</strong><br />
write_file(&#8216;./path/to/file.php&#8217;, $data, &#8216;w+&#8217;);</p>
<p>CI recommends &#8220;r+&#8221; but its better to use &#8220;w+&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://itlivewire.com/devblog/2009/11/02/codeigniter-read-or-write-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

