<?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>Håkon Nessjøen &#187; php</title>
	<atom:link href="http://lunatic.no/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://lunatic.no</link>
	<description>Just another life hacker</description>
	<lastBuildDate>Tue, 29 Jun 2010 17:50:12 +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>Programming in Akelos</title>
		<link>http://lunatic.no/2010/01/programming-in-akelos/</link>
		<comments>http://lunatic.no/2010/01/programming-in-akelos/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 16:31:41 +0000</pubDate>
		<dc:creator>Håkon Nessjøen</dc:creator>
				<category><![CDATA[hobby]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lunatic.no/?p=81</guid>
		<description><![CDATA[For some while I have been using the Akelos library for MVC development within PHP. The reason I like this library over other well-known libraries like Zend Framework, CakePHP etc, is that this library is very much coded with &#8220;Convension over configuration&#8221; which means that you don&#8217;t have to over-configure everything. And it&#8217;s easy to [...]]]></description>
			<content:encoded><![CDATA[<p>For some while I have been using the <a href="http://akelos.org/" target="_blank">Akelos</a> library for <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" target="_blank">MVC</a> development within PHP. The reason I like this library over other well-known libraries like <a href="http://framework.zend.com/" target="_blank">Zend Framework</a>, <a href="http://cakephp.org/" target="_blank">CakePHP</a> etc, is that this library is very much coded with &#8220;Convension over configuration&#8221; which means that you don&#8217;t have to over-configure everything. And it&#8217;s easy to learn new people how to use it.<span id="more-81"></span></p>
<p>For example, when you create a database, you fill inn the fields you like, in a &#8216;installer&#8217;. Each time you need to add fields, you add new up() revisions in the installer, so versioning systems like SVN or git can see that &#8220;in revision x, a new fields was added to the sql table&#8221;. This means that the versioning system can keep track of the database as well as the files.</p>
<p>Something I also love about Akelos is the ease of translation. In the Views you can write so called &#8220;sintags&#8221;. Which is basically the template language in Akelos. To write out the contents of a variable, you write {variable name} if you write text that needs translating, you write _{translate this text}. Thats variables and simple translations. Then you have functions, like a form:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= form_tag <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'myid'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span>= text_field <span style="color:#996600;">'blog'</span>, <span style="color:#996600;">'name'</span>, <span style="color:#ff3333; font-weight:bold;">:class</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'myclass'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&lt;/form&gt;</pre></div></div>

<p>Now I wanted to be able to translate inside function tags, so I made a little <a href="http://trac.akelos.org/ticket/229#comment:2" target="_blank">adjustment</a> to the Akelos source which made it possible to do:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"> <span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to _<span style="color:#996600;">'translated text'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'about'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
    or
 <span style="color:#006600; font-weight:bold;">&lt;%</span>= something <span style="color:#996600;">'name'</span>, <span style="color:#ff3333; font-weight:bold;">:vals</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">'plain text'</span>, _<span style="color:#996600;">'translated text'</span>, _<span style="color:#996600;">'translated text with %variable'</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>Here you also see that translated text also can contain variables from the view scope, which is pretty nifty in regards to dynamic translating. This &#8220;adjustment&#8221; was added to trunk in October 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://lunatic.no/2010/01/programming-in-akelos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
