<?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>Witheringtree &#187; Work</title>
	<atom:link href="http://www.witheringtree.com/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.witheringtree.com</link>
	<description>If a tree falls in the forest and no one is around to hear it fall… yeah, it still makes a sound.</description>
	<lastBuildDate>Mon, 23 Jan 2012 02:07:39 +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>The Dream Team</title>
		<link>http://www.witheringtree.com/2011/12/the-dream-team/</link>
		<comments>http://www.witheringtree.com/2011/12/the-dream-team/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 05:35:04 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=960</guid>
		<description><![CDATA[Torus Marketing]]></description>
			<content:encoded><![CDATA[<p>Torus Marketing<br />
<a href="http://www.witheringtree.com/wp-content/uploads/2011/12/390532_312310245456265_170819309605360_1007615_2090785016_n.jpg" rel="shadowbox[sbpost-960];player=img;"><img src="http://www.witheringtree.com/wp-content/uploads/2011/12/390532_312310245456265_170819309605360_1007615_2090785016_n-300x214.jpg" alt="" title="Torus Marketing" width="300" height="214" class="alignnone size-medium wp-image-961" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2011/12/the-dream-team/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom CodeIgniter Validation Methods</title>
		<link>http://www.witheringtree.com/2011/09/custom-codeigniter-validation-methods/</link>
		<comments>http://www.witheringtree.com/2011/09/custom-codeigniter-validation-methods/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 21:12:05 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips/Tricks]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=944</guid>
		<description><![CDATA[CodeIgniter&#8217;s Form Validation library isn&#8217;t bad. It takes a little getting use to but it can be very powerful. Most of the validation that comes with CodeIgniter are pretty much the only ones you will ever need. Every now and then you will need something else. Extending CodeIgniter libraries is very easy. These are some &#8230; <a href="http://www.witheringtree.com/2011/09/custom-codeigniter-validation-methods/" title="Continue reading">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter&#8217;s <a href="http://codeigniter.com/user_guide/libraries/form_validation.html" title="CodeIgniter Form Validation" target="_blank">Form Validation</a> library isn&#8217;t bad. It takes a little getting use to but it can be very powerful. Most of the validation that comes with CodeIgniter are pretty much the only ones you will ever need. Every now and then you will need something else. <a href="http://codeigniter.com/user_guide/general/creating_libraries.html" title="Creating and Extending CodeIgniter Libraries" target="_blank">Extending CodeIgniter libraries</a> is very easy. These are some of the custom form validation I&#8217;ve had to do in previous projects</p>
<p>First of all, you have to create a library that will extend CodeIgniter&#8217;s library. Create a new file named MY_Form_validation.php and put it in the application/libraries/ directory. Here is what that library will look like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MY_Form_validation <span style="color: #000000; font-weight: bold;">extends</span> CI_Form_validation <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The first validation method I used for a project where the user would enter a fraction and I didn&#8217;t really want to convert a decimal to a fraction. So I just created a validation method.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Fraction
 *
 * @access  public
 * @param   string  $str
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fraction<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fraction'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'The %s field must be a valid fraction.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/^(\d++(?! */))? *-? *(?:(\d+) */ *(\d+))?.*$/&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'screen_size'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Screen Size'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fraction'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This was a fun validation to make. When a user signs up or is changing their password, their password must be <a href="http://www.pcicomplianceguide.org/" title="PCI Compliance" target="_blank">PCI compliant</a>. For a password to be PCI compliant, it must meet the following:<br />
1) Must be between 6 and 99 characters in length<br />
2) Must not contain two consecutively repeating characters<br />
3) Must contain at least one upper-case letter<br />
4) Must contain at least one lower-case letter<br />
5) Must contain at least one number<br />
6) Must contain at least one special character</p>
<p>Please note that the validation message is really long. You may want to simplify it a little before using it</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * PCI compliance password
 *
 * @access  public
 * @param   $str
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> pci_password<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$special</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'!@#$%*-_=+.'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pci_password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'For PCI compliance, %s must be between 6 and 99 characters in length, must not contain two consecutively repeating characters, contain at least one upper-case letter, at least one lower-case letter, at least one number, and at least one special character ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$special</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^(?=^.{6,99}$)(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*['</span><span style="color: #339933;">.</span><span style="color: #000088;">$special</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'])(?!.*?(.)\1{1,})^.*$/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">TRUE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'pci_password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>CodeIgniter already has a validation method for <em>required</em>. But I needed one to be required if a different field had a value. A couple weeks later I needed to have method to make a field required if another field had a certain value.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Required if another field has a value (related fields) or if a field has a certain value
 *
 * @access  public
 * @param   string  $str
 * @param   string  $field
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> required_if<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fld</span><span style="color: #339933;">,</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required_if'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'The %s field is required.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// $fld is filled out</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$fld</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Must have specific value</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Not the specific value we are looking for</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$fld</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$val</span> AND <span style="color: #339933;">!</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Bar'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required_if[foo]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// required if field 'foo' has a value</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Foo Bar'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required_if[foo,bar]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// required if field 'foo' has a value of 'bar'</span></pre></div></div>

<p>There are a lot of examples of this validation floating around. It requires that a value being passed has a unique value in the database. This one also takes into account the database prefix.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Unique
 *
 * @access	public
 * @param	string
 * @param	field
 * @return	bool
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> unique<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span> <span style="color: #000088;">$column</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unique'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'The %s that you requested is already in use.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT COUNT(*) AS dupe FROM {<span style="color: #006699; font-weight: bold;">$this-&gt;CI</span>-&gt;db-&gt;dbprefix(<span style="color: #006699; font-weight: bold;">$table</span>)} WHERE <span style="color: #006699; font-weight: bold;">{$column}</span> = '<span style="color: #006699; font-weight: bold;">{$str}</span>'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">row</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dupe</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unique[DBTABLE,DBFIELD]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// DBTABLE is the database table and DBFIELD is the database field to validation against</span></pre></div></div>

<p>I took the previous validation a step further so that the field value must be unique in the database EXCEPT for a certain record ID. This one is really good for if you have an existing user in the system and they are updating their profile. You want to make sure that their email address is unique. If you run the previous <em>unique</em> validation it will fail because the email address is already in use by the user currently being edited. So we need to exclude that users ID from the validation. This one also takes into account the database prefix.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Unique except. Check if a specific value is in use except when the value is attached to a specific row ID
 *
 * @param	string
 * @param	field
 * @return	bool
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> unique_exclude<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span> <span style="color: #000088;">$column</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fld</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_message</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unique_exclude'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'The %s that you requested is already in use.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT COUNT(*) AS dupe FROM {<span style="color: #006699; font-weight: bold;">$this-&gt;CI</span>-&gt;db-&gt;dbprefix(<span style="color: #006699; font-weight: bold;">$table</span>)} WHERE <span style="color: #006699; font-weight: bold;">{$column}</span> = '<span style="color: #006699; font-weight: bold;">$str</span>' AND <span style="color: #006699; font-weight: bold;">{$fld}</span> &lt;&gt; <span style="color: #006699; font-weight: bold;">{$id}</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">row</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dupe</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unique[DBTABLE,DBFIELD,IDFIELD,ID]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// DBTABLE is the database table, DBFIELD is the database field, IDFIELD is the primary key for the table, and ID is the unique ID for the user</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2011/09/custom-codeigniter-validation-methods/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Zend Server CE on OS X: A Guide For the Terminal Timid</title>
		<link>http://www.witheringtree.com/2011/07/installing-zend-server-ce-on-os-x-a-guide-for-the-terminal-timid/</link>
		<comments>http://www.witheringtree.com/2011/07/installing-zend-server-ce-on-os-x-a-guide-for-the-terminal-timid/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 17:29:56 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Tips/Tricks]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=921</guid>
		<description><![CDATA[I use MAMP Pro both at home and at work for development. It quick, it&#8217;s easy and I really don&#8217;t have to fiddle with it a lot after it is set up. It&#8217;s perfect for me. At work we have a project to be built with Codeigniter sitting on a Linux machine but we wanted &#8230; <a href="http://www.witheringtree.com/2011/07/installing-zend-server-ce-on-os-x-a-guide-for-the-terminal-timid/" title="Continue reading">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
	I use <a href="http://mamp.info/" title="MAMP Pro" target="_blank">MAMP Pro</a> both at home and at work for development. It quick, it&#8217;s easy and I really don&#8217;t have to fiddle with it a lot after it is set up. It&#8217;s perfect for me.
</p>
<p>
	At work we have a project to be built with <a href="http://www.codeigniter.com/" title="Codeigniter" target="_blank">Codeigniter</a> sitting on a Linux machine but we wanted to use Microsoft SQL Server on a different machine as the database. Turns out, it&#8217;s not a simple as changing the database type in Codeigniter to &#8220;mssql&#8221; to get it up and running. If this is all you do, you get the dreaded white screen. You need a PHP extension to do it. Problem is, Microsoft only makes this PHP extension for Windows. There are a lot of tutorials out there on how to build the extension yourself on Mac or Linux machine (<a href="http://www.dotvoid.com/2010/01/adding-support-for-ms-sql-server-to-php-in-linux/" target="_blank">this site for example</a>), but none seemed to work for me.
</p>
<p>
	Instead of setting up a Windows virtual machine and being forced into developing that way, I decided to install Zend Server CE. Zend comes with a MSSQL extension, it just needs to be enabled.
</p>
<p>
	This tutorial does include Terminal work. I am going to walk through step-by-step, so even if you are not comfortable with Terminal, you will be up and running with Zend Server CE in no time. The only requirement is you are running an Intel Mac OS X.
</p>
<p><span id="more-921"></span></p>
<ol>
<li>
<p>
			<a href="http://www.zend.com/en/products/server-ce/index" title="Zend Server CE" target="_blank">Download Zend Server CE</a>. CE (Community Edition) is free.
		</p>
</li>
<li>
<p>
			Install Zend Server CE like you would any other application. You can optionally drop/drop Zend Controller.app into your applications directory if you want.
		</p>
</li>
<p>
			Once installed, in your applications directory, open ZendServer.app. This will open a browser window. Go through the three steps. Congratulations! You have Zend Server CE set up and running. But we aren&#8217;t done yet.
		</p>
<p>
			By default, the root folder of your Zend Server is at /usr/local/zend/htdocs. Since /usr is a hidden directory, it&#8217;s not easily accessible.
		</p>
<p>
			But first&#8230;
		</p>
</li>
<li>
<p>
			Open Terminal. Terminal can be found at /Applications/Utilities/Terminal.app
		</p>
<p>
			You can also open it from Spotlight by typing &#8220;Terminal&#8221;
		</p>
</li>
<li>
<p>
			OS X comes with Apache already installed. We don&#8217;t want to use that version. We want to use the Zend Server version.
		</p>
<p>
			In Terminal type:<br />
			<code><br />
				sudo /usr/local/zend/bin/zendctl.sh stop<br />
			</code><br />
			To stop Zend Server. Then type:<br />
			<code><br />
			sudo apachectl stop<br />
			</code></p>
<p>
			Enter your password if prompted
		</p>
</li>
<li>
<p>
			We need to move apachectl to a safe place, such as your home directory. In Terminal type:<br />
			<code><br />
				cd /usr/sbin/<br />
				sudo mv apachectl /Users/YOUR_USERNAME/<br />
			</code>
		</p>
</li>
<li>
<p>
			Then create a symbolic link to Zend Server&#8217;s apachectl. In Terminal type:<br />
			<code><br />
				sudo ln -s /usr/local/zend/apache2/bin/apachectl ./<br />
			</code>
		</p>
</li>
<li>
<p>
			Start Zend Server&#8217;s Apache. In Terminal type:<br />
			<code><br />
				sudo apachectl start<br />
			</code>
		</p>
<p>
			You should then see:<br ><br />
			<code><br />
				/usr/sbin/apachectl start [OK]<br />
			</code>
		</p>
</li>
<li>
<p>
			If you go to http://localhost/ in your browser, you will either get a forbidden or a 404 message. We&#8217;ll change that next.
		</p>
</li>
<li>
<p>
			Zend Studio&#8217;s Apache comes preconfigured to use port 10088. Let&#8217;s change this to port 80 like the default Apache port uses.
		</p>
<p>
			Now we are getting into <a href="http://en.wikipedia.org/wiki/Vi" target="_blank">vi</a> editing. I think this scares a lot of people. But don&#8217;t worry. It&#8217;s very simple.
		</p>
<p>
			We are going to edit our httpd.conf file. In Terminal type:<br />
			<code><br />
				sudo vi /usr/local/zend/apache2/conf/httpd.conf<br />
			</code>
		</p>
<p>
			Enter your password when prompted
		</p>
</li>
<li>
<p>
			You are in vi edit mode so you won&#8217;t be able to type in Terminal like you normally would. Typing only gives you the the OS X bump sound. That&#8217;s normal. You can use the up, down, left, right arrow keys.
		</p>
<p>
			Look for the line that says &#8220;Listen 10088&#8243;
		</p>
<p>
			In Terminal, type &#8220;i&#8221; to go into edit mode to start editing the file. At the bottom of the Terminal window it will say &#8220;&#8211; INSERT &#8211;&#8221; to notify you that you are editing the file.
		</p>
</li>
<li>
<p>
			With your blinker over the &#8220;L&#8221; on &#8220;Listen&#8221;, type &#8220;#&#8221; to comment out that line
		</p>
<p>
			Use the down arrow to go to the next line.
		</p>
<p>
			Type:<br />
			<code><br />
				Listen 80<br />
			</code>
		</p>
</li>
<li>
<p>
			Since we are already editing this file, we will go ahead and change our root directory since, as I mentioned earlier, the /usr directory is a hidden directory.
		</p>
<p>
			Use the down arrow to scroll down to where it says<br />
			<code><br />
				DocumentRoot "/usr/local/zend/apache2/htdocs"<br />
			</code>
		</p>
<p>
			With your blinker over the &#8220;D&#8221; on &#8220;DocumentRoot&#8221;, type &#8220;#&#8221; to comment out that line
		</p>
<p>
			Use the down arrow to go to the next line.
		</p>
<p>
			Type:<br />
			<code><br />
				DocumentRoot "/Users/YOUR_USERNAME/Sites"<br />
			</code>
		</p>
<p>
			This is the default web root for OS X sites. This is a pretty good place to put out root as well.
		</p>
</li>
<li>
<p>
			Use the down arrow again to scroll down to where it says<br />
			<code><br />
				&lt;Directory "/usr/local/zend/apache2/htdocs"&gt;<br />
			</code>
		</p>
<p>
			With your blinker over the &#8220;&lt;&#8221;, type &#8220;#&#8221; to comment out that line
		</p>
<p>
			Use the down arrow to go to the next line.
		</p>
<p>
			Type:<br />
			<code><br />
				&lt;Directory "/Users/YOUR_USERNAME/Sites"&gt;<br />
			</code>
	</li>
<li>
<p>
			We are done editing this file. Now we need to save it. In Terminal, hit the escape key to edit out of editing mode. The &#8220;&#8211; INSERT &#8211;&#8221; at the bottom will go away.
		</p>
<p>
			In Terminal again, type &#8220;:x&#8221;. This exits vi mode and saves what you changed
		</p>
</li>
<li>
<p>
			Restart apachectl type typing:<br />
			<code><br />
				sudo apachectl restart<br />
			</code>
		</p>
<p>
			Enter your password when prompted
		</p>
</li>
<li>
<p>			If you go to http://localhost/ in your browser, you will see the default Mac OS X homepage now.
		</p>
</li>
<li>
<p>
			To configure Zend Framework, type:<br />
			<code><br />
				sudo ln -s /usr/local/zend/share/ZendFramework/bin/zf.sh ./zf<br />
			</code>
	</li>
<li>
<p>
			To Configure Pear, type<br />
			<code><br />
				sudo ln -s /usr/local/zend/bin/pear ./<br />
				sudo pear upgrade pear<br />
			</code>
		</p>
</li>
<li>
<p>
			Now we have to configure MySQL. In terminal type:<br />
			<code><br />
				sudo ln -s /usr/local/zend/mysql/bin/mysql ./<br />
				sudo ln -s /usr/local/zend/mysql/bin/mysqladmin ./<br />
			</code>
		</p>
</li>
<li>
<p>
			We have to edit some settings in my.cnf for MySQL, so we go back to vi. In Terminal, type:<br />
			<code><br />
				sudo vi /usr/local/zend/mysql/data/my.cnf<br />
			</code>
		</p>
<p>
			To edit the file, it is similar to what you did in step 10.
		</p>
<p>
			Use the down arrow to scroll down to where it says:<br />
			<code><br />
				socket = /usr/local/zend/mysql/tmp/mysql.sock<br />
			</code>
		</p>
<p>
			With your blinker over the &#8220;s&#8221; on &#8220;socket&#8221;, type &#8220;#&#8221; to comment out that line
		</p>
<p>
			Use the down arrow to go to the next line.
		</p>
<p>
			Type:<br />
			<code><br />
				socket = /tmp/mysql.sock<br />
			</code>
		</p>
</li>
<li>
<p>
			By default, the password that comes with Zend Server is blank. You can change this by removing the &#8220;#&#8221; next to &#8220;password&#8221; and then changing &#8220;you_password&#8221; to whatever you want. Make sure you remember what the password is though.
		</p>
</li>
<li>
<p>
			To save the file, it is similar to what you did in step 14.
		</p>
</li>
<li>
<p>
			Configure phpMyAdmin. Since we changed the web root for Apache, we will have to create a Directory entry and Alias for phpMyAdmin, since it exists somewhere else. To edit the httpd.conf file again, in Terminal type:<br />
			<code><br />
				sudo vi /usr/local/zend/apache2/conf/httpd.conf<br />
			</code>
		</p>
<p>
			Enter your password when prompted
		</p>
</li>
<li>
<p>
			To start editing the file, use similar steps from step 10.
		</p>
<p>
			Somewhere in the file (I put it at the very end), type:<br />
			<code><br />
				Alias /phpMyAdmin /usr/local/zend/share/phpmyadmin<br />
				&lt;Directory "/usr/local/zend/share/phpmyadmin"&gt;<br />
					&nbsp;&nbsp;&nbsp;&nbsp;Options Indexes FollowSymLinks<br />
					&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride All<br />
					&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<br />
					&nbsp;&nbsp;&nbsp;&nbsp;Allow from all<br />
				&lt;/Directory&gt;<br />
			</code>
		</p>
<p>
			* Hint: Yes, you can copy/paste this if you don&#8217;t want to type it all out yourself.
		</p>
<p>
			To save the file, use similar steps from step 14.
		</p>
</li>
<li>
		Go ahead and restart Zend Server. In Terminal, type:<br />
		sudo /usr/local/zend/bin/zendctl.sh restart
	</li>
</ol>
<h3>Where do I put the file for my website(s)?</h3>
<p>
	Files will be places in /Users/YOUR_USERNAME/Sites
</p>
<p>
	Yes, of course you can create directories within that folder.
</p>
<h3>What is the URL for my site?</h3>
<p>
	The root of your site is now at <a href="http://localhost/" target="_blank">http://localhost/</a> If you have a directory within the /Users/YOUR_USERNAME/Sites directory, the URL would become http://localhost/FOLDER_NAME
</p>
<p>
	To configure Zend Server, you can get to it by going to <a href="http://localhost:10081/ZendServer/" target="_blank">http://localhost:10081/ZendServer/</a> or simply by opening ZendServer.app
</p>
<p>
	phpMyAdmin is located at <a href="http://localhost/phpMyAdmin" target="_blank">http://localhost/phpMyAdmin</a> The default username is &#8220;zend&#8221; and the password is left blank. You can also use &#8220;root&#8221; as the username. Again, with no password.
</p>
<h3>How do I start/stop/restart Zend Server?</h3>
<p>
	To start Zend Server, in Terminal type:<br />
	<code><br />
		sudo /usr/local/zend/bin/zendctl.sh start<br />
	</code>
</p>
<p>
	To stop Zend Server, in Terminal type:<br />
	<code><br />
		sudo /usr/local/zend/bin/zendctl.sh stop<br />
	</code>
</p>
<p>
	To restart Zend Server, in Terminal type:<br />
	<code><br />
		sudo /usr/local/zend/bin/zendctl.sh restart<br />
	</code>
</p>
<h3>Uninstalling Zend Server</h3>
<ol>
<li>
<p>
			Open Terminal
		</p>
</li>
<li>
<p>
			Enter<br />
			<code><br />
				sudo /usr/local/zend/bin/uninstall.sh<br />
			</code>
		</p>
<p>
			This will:</p>
<ol>
<li>Stop all Zend Server processes</li>
<li>Delete all Zend Server installed files</li>
<li>Remove the ZendServer.app from /Applications</li>
<li>Remove Zend users</li>
</ol>
</li>
<li>
<p>
			It will ask for your password. Enter your password
		</p>
</li>
<li>
<p>
			It will ask you if you are sure you want to remove Zend Server. Type &#8220;yes&#8221; (without the double quotes)
		</p>
</li>
<li>
<p>
			It tells you it will a couple directories, including your MySQL databases. Type &#8220;cont&#8221; (without the double quotes) to continue
		</p>
</li>
<li>
<p>
			In your applications directory, drag Zend Controller.app to the trash (if it is installed)
		</p>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2011/07/installing-zend-server-ce-on-os-x-a-guide-for-the-terminal-timid/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>96336 Minutes</title>
		<link>http://www.witheringtree.com/2011/02/96336-minutes/</link>
		<comments>http://www.witheringtree.com/2011/02/96336-minutes/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 02:02:01 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Fail]]></category>
		<category><![CDATA[Funny]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=910</guid>
		<description><![CDATA[Only 66 more days before Entourage automatically checks for more email&#8230;]]></description>
			<content:encoded><![CDATA[<p>Only 66 more days before Entourage automatically checks for more email&#8230;</p>
<p><a href="http://www.witheringtree.com/wp-content/uploads/2011/02/96336-minutes.png" rel="shadowbox[sbpost-910];player=img;"><img class="alignnone size-medium wp-image-911" title="96336 Minutes" src="http://www.witheringtree.com/wp-content/uploads/2011/02/96336-minutes-300x198.png" alt="" width="300" height="198" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2011/02/96336-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Fix RSA Host Key Change Error on Mac</title>
		<link>http://www.witheringtree.com/2011/01/how-to-fix-rsa-host-key-change-error-on-mac/</link>
		<comments>http://www.witheringtree.com/2011/01/how-to-fix-rsa-host-key-change-error-on-mac/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 02:03:05 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=887</guid>
		<description><![CDATA[At work recently, we wiped a Fedora development server and reinstalled with the newer version of the OS. When everything was back up and running, I tried to connect to it through SSH. I got an error I hadn&#8217;t seen before about my RSA host key is wrong. First of all, the error I was &#8230; <a href="http://www.witheringtree.com/2011/01/how-to-fix-rsa-host-key-change-error-on-mac/" title="Continue reading">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At work recently, we wiped a Fedora development server and reinstalled with the newer version of the OS. When everything was back up and running, I tried to connect to it through SSH. I got an error I hadn&#8217;t seen before about my RSA host key is wrong.</p>
<p>First of all, the error I was getting is below:<br />
<a href="http://www.witheringtree.com/wp-content/uploads/2011/01/rsa.png" rel="shadowbox[sbpost-887];player=img;"><img class="alignnone size-medium wp-image-888" title="RSA" src="http://www.witheringtree.com/wp-content/uploads/2011/01/rsa-300x228.png" alt="" width="300" height="228" /></a></p>
<p>This was actually pretty easy to fix. Since you are already trying to SSH, this assumes you already know where Terminal is and you have it opened:</p>
<p>1) Inside Terminal, type<br />
<em><strong>cd /Users/YOUR_USERNAME/.ssh</strong></em><br />
Where YOUR_USERNAME is your login name for your Mac. If you don&#8217;t what what it is, your login name is the word right before the $ in the Terminal window.</p>
<p>2) Inside Terminal again, type<br />
<em><strong>rm known_hosts</strong></em><strong> </strong></p>
<p>That&#8217;s it. Your done. You can now go through SSH again. A new RSA key will be generated for you automatically. All this really did was delete a file named <em>known_hosts</em> inside the hidden <em>/Users/YOUR_USERNAME/.ssh </em>directory. Since it deleted the file, this also means that RSA keys for other SSH connections will be lost as well. However the next time you SSH to them, you will be given a new key automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2011/01/how-to-fix-rsa-host-key-change-error-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office</title>
		<link>http://www.witheringtree.com/2010/09/office/</link>
		<comments>http://www.witheringtree.com/2010/09/office/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 15:24:20 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Me]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=786</guid>
		<description><![CDATA[I hung up the American flag behind my desk at work. Next up, Marine Corps flag.]]></description>
			<content:encoded><![CDATA[<p>I hung up the American flag behind my desk at work. Next up, Marine Corps flag.</p>
<p><a href="http://www.witheringtree.com/wp-content/uploads/2010/09/20100731152638.jpg" rel="shadowbox[sbpost-786];player=img;"><img class="alignnone size-medium wp-image-787" title="Flag" src="http://www.witheringtree.com/wp-content/uploads/2010/09/20100731152638-225x300.jpg" alt="" width="225" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2010/09/office/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ethernet Cable</title>
		<link>http://www.witheringtree.com/2010/09/ethernet-cable/</link>
		<comments>http://www.witheringtree.com/2010/09/ethernet-cable/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 15:17:04 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Funny]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=782</guid>
		<description><![CDATA[Yes, this is an ethernet cable tied to the blinds]]></description>
			<content:encoded><![CDATA[<p>Yes, this is an ethernet cable tied to the blinds</p>
<p><a href="http://www.witheringtree.com/wp-content/uploads/2010/09/20100706122310.jpg" rel="shadowbox[sbpost-782];player=img;"><img class="alignnone size-medium wp-image-783" title="Ethernet cable" src="http://www.witheringtree.com/wp-content/uploads/2010/09/20100706122310-225x300.jpg" alt="" width="225" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2010/09/ethernet-cable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Darth Vader</title>
		<link>http://www.witheringtree.com/2010/03/darth-vader/</link>
		<comments>http://www.witheringtree.com/2010/03/darth-vader/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 06:12:56 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Self]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[Me]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=716</guid>
		<description><![CDATA[I have some kind of obsession with Darth Vader. I don&#8217;t even like the Star Wars movies, but I really like Darth Vader. At work, they changed my name of my phone to say &#8216;Darth Vader&#8217;. So when I call someone, their phone says like Darth Vader is calling them. How cool is that!]]></description>
			<content:encoded><![CDATA[<p>I have some kind of obsession with Darth Vader. I don&#8217;t even like the Star Wars movies, but I really like Darth Vader. At work, they changed my name of my phone to say &#8216;Darth Vader&#8217;. So when I call someone, their phone says like Darth Vader is calling them. How cool is that!</p>
<p><a title="Darth Vader" rel="lightbox" href="http://www.witheringtree.com/wp-content/uploads/2010/03/darth_vader.jpg"><img class="alignnone size-medium wp-image-717" title="Darth Vader" src="http://www.witheringtree.com/wp-content/uploads/2010/03/darth_vader-300x225.jpg" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2010/03/darth-vader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending Template Parser</title>
		<link>http://www.witheringtree.com/2009/12/extending-template-parser/</link>
		<comments>http://www.witheringtree.com/2009/12/extending-template-parser/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 18:31:57 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=599</guid>
		<description><![CDATA[I am working on some stuff for work (yes, on the weekend) that uses the Codeigniter Template Parser class to display content with pseudo variables. I have a pseudo variable parser that allows me to call up a certain function from a certain helper file. To do this I would do something similar to this: &#8230; <a href="http://www.witheringtree.com/2009/12/extending-template-parser/" title="Continue reading">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am working on some stuff for work (yes, on the weekend) that uses the Codeigniter Template Parser class to display content with pseudo variables. I have a pseudo variable parser that allows me to call up a certain function from a certain helper file. To do this I would do something similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>ns<span style="color: #339933;">:</span>gallery<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'foo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>Where &#8220;df&#8221; is the name of the helper file (minus &#8220;_helper&#8221;) that gets loaded in if it hasn&#8217;t been already, &#8220;gallery&#8221; is the name of the function, and everything inside the brackets are values that get passed to the function.</p>
<p>I also thought about doing something more like HTML tags with pseudo variables. So the above example could be:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>ns<span style="color: #339933;">:</span>gallery name<span style="color: #339933;">=</span><span style="color: #0000ff;">'foo'</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>Similar concept but this way all of the attributes could be thrown into an object when it gets o the function so I can have as many or as few settings in it as I want instead of having to pass a certain number of arguments in a certain order. I would have to have default values for everything in case an attribute I needed wasn&#8217;t passed. Same idea as the way HTML tags work.</p>
<p>This is basically like creating my own pseudo HTML tags with { and } instead of &lt; and &gt;. So then I thought, why not make it a namespace tag? I would just have to replace the { and } with &lt; and &gt; and I get:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>ns<span style="color: #339933;">:</span>gallery name<span style="color: #339933;">=</span><span style="color: #0000ff;">'foo'</span> <span style="color: #339933;">/&gt;</span></pre></div></div>

<p>To do this I would so something similar to this post titled &#8216;<a href="http://stackoverflow.com/questions/1201778/parsing-custom-tags-with-php" target="_blank">Parsing Custom Tags With PHP</a>&#8216;.</p>
<p>There are advantages and disadvantages to all three. Right now I am leaning more toward the second or third options because if someone goes in after me and needs to edit the file, I think that makes more sense than the first way. Any way I go it just means extending the Codeigniter Template Parser class. Maybe I&#8217;ll do all three and release it to the Codeigniter community.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2009/12/extending-template-parser/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reminiscing On My Professional Work</title>
		<link>http://www.witheringtree.com/2009/05/reminiscing-on-my-professional-work/</link>
		<comments>http://www.witheringtree.com/2009/05/reminiscing-on-my-professional-work/#comments</comments>
		<pubDate>Mon, 11 May 2009 02:06:14 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Me]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=111</guid>
		<description><![CDATA[I was thinking about some of the sites I have worked on. I started trying to remember the very first website I worked on as a professional developer. I couldn&#8217;t remember what it was. Keep in mind this was back in 1998 so it has been a while. So I messaged my old boss and &#8230; <a href="http://www.witheringtree.com/2009/05/reminiscing-on-my-professional-work/" title="Continue reading">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was thinking about some of the sites I have worked on. I started trying to remember the very first website I worked on as a professional developer. I couldn&#8217;t remember what it was. Keep in mind this was back in 1998 so it has been a while. So I messaged my old boss and asked him.</p>
<p>The very first website that I ever worked on was an event calendar. A lady just found out her daughter was a lesbian. In order to be supportive, we decided to make a website of all of the upcoming events in gay and lesbian community. Unfortunately, the site is no longer online. It would have been fun to see how it had progressed since I last worked on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/2009/05/reminiscing-on-my-professional-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

