<?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>WPStorm &#187; CodeIgniter</title>
	<atom:link href="http://wpstorm.net/category/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpstorm.net</link>
	<description>Coding, Wordpress and Plugin Development</description>
	<lastBuildDate>Mon, 30 Jan 2012 00:25:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Email log messages library in CodeIgniter</title>
		<link>http://wpstorm.net/2009/05/email-log-messages-library-codeigniter/</link>
		<comments>http://wpstorm.net/2009/05/email-log-messages-library-codeigniter/#comments</comments>
		<pubDate>Sun, 31 May 2009 16:53:08 +0000</pubDate>
		<dc:creator>Lotta</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wpstorm.net/?p=231</guid>
		<description><![CDATA[When working with CodeIgniter, I&#8217;ve found the log message functionality built into the framework very helpful. The other day I noticed in my log of one of my CodeIgniter based sites that I&#8217;ve had some 404 errors going on for some time. As I don&#8217;t have the time to check my logs daily, I hadn&#8217;t ...]]></description>
			<content:encoded><![CDATA[<p>When working with CodeIgniter, I&#8217;ve found the log message functionality built into the framework very helpful. The other day I noticed in my log of one of my CodeIgniter based sites that I&#8217;ve had some 404 errors going on for some time. As I don&#8217;t have the time to check my logs daily, I hadn&#8217;t noticed this problem until now.</p>
<p>This led me to think that it would be real handy to get the log messages sent out by email as well, so you don&#8217;t risk to have a problem going on at the site unnoticed for days or even weeks.</p>
<p>So I wrote an extension to the native Log class in CodeIgniter which adds this functionality. Below is the code for MY_Log.php which extends the CI_Log class. MY_Log calls the native Log functions so the log file still gets generated, and if a log message was executed it also gets sent out by email afterward.</p>
<p>Change the email address in the code to the one you want to receive the log messages to, and then save the file in your application/libraries/ folder as MY_Log.php. This assumes that your Class Extension Prefix is set to MY_ in your config file.</p>
<p>I hope some of you find this class extension useful, and feel free to improve upon it. Cheers!</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/**
 * MY_Log Class
 *
 * This library extends the native Log library.
 * It adds the function to have the log messages being emailed when they have been outputted to the log file.
 *
 * @package		CodeIgniter
 * @subpackage		Libraries
 * @category		Logging
 * @author		Johan Steen
 * @link		http://wpstorm.net/
 */
class MY_Log extends CI_Log {
	/**
	 * Constructor
	 *
	 * @access	public
	 */
	function MY_Log()
	{
		parent::CI_Log();
	}

	/**
	 * Write Log File
	 *
	 * Calls the native write_log() method and then sends an email if a log message was generated.
	 *
	 * @access	public
	 * @param	string	the error level
	 * @param	string	the error message
	 * @param	bool	whether the error is a native PHP error
	 * @return	bool
	 */
	function write_log($level = 'error', $msg, $php_error = FALSE)
	{
		$result = parent::write_log($level, $msg, $php_error);

		if ($result == TRUE &amp;&amp; strtoupper($level) == 'ERROR') {
			$message = &quot;An error occurred: \n\n&quot;;
			$message .= $level.' - '.date($this-&gt;_date_fmt). ' --&gt; '.$msg.&quot;\n&quot;;

			$to = 'someone@example.com';
			$subject = 'An error has occured';
			$headers = 'From: Example Name &lt;no-reply@example.com&gt;' . &quot;\r\n&quot;;
			$headers .= 'Content-type: text/plain; charset=utf-8\r\n';

			mail($to, $subject, $message, $headers);
		}
		return $result;
	}
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wpstorm.net/2009/05/email-log-messages-library-codeigniter/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The CodeIgniter PHP Framework</title>
		<link>http://wpstorm.net/2009/05/codeigniter-php-framework/</link>
		<comments>http://wpstorm.net/2009/05/codeigniter-php-framework/#comments</comments>
		<pubDate>Mon, 25 May 2009 01:15:33 +0000</pubDate>
		<dc:creator>Lotta</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wpstorm.net/?p=126</guid>
		<description><![CDATA[I recently stumbled upon the CodeIgniter PHP framework, and a love affair has slowly begun between me and CI. To make a long story short, WordPress is my favorite system to base a new websites on, and today you can make about any site in WordPress if you are patient enough. Personally I have always ...]]></description>
			<content:encoded><![CDATA[<p>I recently stumbled upon the <a title="CodeIgniter PHP framework" href="http://codeigniter.com/">CodeIgniter</a> PHP framework, and a love affair has slowly begun between me and CI.</p>
<p>To make a long story short, WordPress is my favorite system to base a new websites on, and today you can make about any site in WordPress if you are patient enough. Personally I have always worked with the mindset of using the right tool for each job to get it done as quick and easy as possible.</p>
<p>I have a few WordPress based sites, but I also run two sites where WordPress just don&#8217;t cut it if I don&#8217;t want to spend an enormous amount of time writing custom plugins. I have built a vintage clothing webshop for a dear friend of mine called <a title="Sugarmood - Vintage Retro Kläder - Second Hand" href="http://www.sugarmood.se/">Sugarmood</a> as well as a memorial site for our old Amiga demoscene group <a title="Equinox - Amiga Demo Scene Group" href="http://www.eqxscene.com/">Equinox</a>.</p>
<p>Neither of those two sites would work very well to develop within the WordPress system, so I have written them in plain PHP from scratch. And they work pretty well, but as they have grown in features I started to feel that searching through all the code was becoming cumbersome for each change or update. Coming from a classic application development background for the desktop I wanted to make a MVC (Model &#8211; View &#8211; Controller) based design instead in PHP to get a structured web application to easy update and extend upon.</p>
<p>So I wrote a few MVC prototypes in PHP to get the ball rolling and build a nice base framework to make sites upon where I easily could reuse code and write any custom functions. And they worked pretty fine.</p>
<p>But Doh! I forgot it was 2009 already and most things you can think of is already thought of.</p>
<p>Fortunately I did some googling resarch for some MVC techniques and stumbled upon some very fine PHP MVC Open Source frameworks out there. Why re-invent the wheel? So I downloaded CakePHP, Zend Framework and CodeIgniter, installed them all and explored and evaluated them.</p>
<p>They are all good frameworks for using the MVC model to develop web sites around but in the end my choice fell on CodeIgniter. Mainly because it was very lightweight and didn&#8217;t have it&#8217;s own huge library of custom commands that would take some considerable amount of time to learn. Remember I don&#8217;t do this fulltime so I wanted something that works well, was flexible and with a low learning curve so I could get going right away.</p>
<p>CodeIgniter fulfilled everything I wanted and more, and if you are already familiar with object oriented PHP programming the learning treshold is virtually zero. This suited me perfect.</p>
<p>So I&#8217;ll now begin moving these two sites into the CodeIgniter framework and then take them to the next step when I have them in place.</p>
<p>In this coming journey to get into the CodeIgniter world I&#8217;ll probably write quite a lot of custom libraries and plugins to extend it, everthing which I plan to also release here as well as writing a few articles around if I find out some interesting techniques. So keep your eyes open, as time passes there will be quite some CodeIgniter related articles, code snippets, tutorials and downloads available here.</p>
<p>So I say, come on and ignite me, baby!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpstorm.net/2009/05/codeigniter-php-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

