<?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; CodeIgniter</title>
	<atom:link href="http://www.witheringtree.com/index.php/category/codeigniter/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>Sat, 31 Jul 2010 20:25:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Extending Template Parser</title>
		<link>http://www.witheringtree.com/index.php/2009/12/extending-template-parser/</link>
		<comments>http://www.witheringtree.com/index.php/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:

&#123;ns:gallery&#91;'foo'&#93;&#125;

Where [...]]]></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/index.php/2009/12/extending-template-parser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Route Everything, Except These Controllers</title>
		<link>http://www.witheringtree.com/index.php/2009/10/route-everything-except-these-controllers/</link>
		<comments>http://www.witheringtree.com/index.php/2009/10/route-everything-except-these-controllers/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 13:56:53 +0000</pubDate>
		<dc:creator>David Freerksen</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips/Tricks]]></category>

		<guid isPermaLink="false">http://www.witheringtree.com/?p=404</guid>
		<description><![CDATA[I was playing with CodeIgniter routing at work. I wanted to have a catch-all route but I needed to exclude a certain controller, or controllers, from that catch-all route. As an example, I wanted to have http://www.example.com/(ANYTHING) route to the &#8220;page&#8221; controller. http://www.example.com/policies/shipping would route to the &#8220;policies&#8221; controller and then to the &#8220;ship&#8221; method. [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing with <a title="CodeIgniter" href="http://www.codeigniter.com" target="_blank">CodeIgniter</a> routing at work. I wanted to have a catch-all route but I needed to exclude a certain controller, or controllers, from that catch-all route. As an example, I wanted to have http://www.example.com/(ANYTHING) route to the &#8220;page&#8221; controller. http://www.example.com/policies/shipping would route to the &#8220;policies&#8221; controller and then to the &#8220;ship&#8221; method. From there the &#8220;page&#8221; controller would split up all of the segments.</p>
<p>I started out with this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'policies/shipping'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;policies/ship&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'(:any)'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;page&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The &#8220;policies/ship&#8221; route would be caught by the &#8220;policies&#8221; controller and everything else would be caught by the &#8220;page&#8221; controller. Except the &#8220;page&#8221; controller was getting everything.</p>
<p>I needed to exclude certain controllers from the catch-all route. After a Google search, I came up with nothing. So I started working on it myself. Here is what I cam up with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'policies/shipping'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;policies/ship&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'^(?!policies|controllerA|controllerB)\S*'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;page&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So far it seems to work perfectly. Hopefully this helps someone else out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.witheringtree.com/index.php/2009/10/route-everything-except-these-controllers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
