{"id":81,"date":"2010-01-24T17:31:41","date_gmt":"2010-01-24T16:31:41","guid":{"rendered":"http:\/\/lunatic.no\/?p=81"},"modified":"2010-01-24T17:31:41","modified_gmt":"2010-01-24T16:31:41","slug":"programming-in-akelos","status":"publish","type":"post","link":"http:\/\/130.61.186.249\/index.php\/2010\/01\/24\/programming-in-akelos\/","title":{"rendered":"Programming in Akelos"},"content":{"rendered":"<p>For some while I have been using the <a href=\"http:\/\/akelos.org\/\" target=\"_blank\" rel=\"noopener\">Akelos<\/a> library for <a href=\"http:\/\/en.wikipedia.org\/wiki\/Model%E2%80%93view%E2%80%93controller\" target=\"_blank\" rel=\"noopener\">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\" rel=\"noopener\">Zend Framework<\/a>, <a href=\"http:\/\/cakephp.org\/\" target=\"_blank\" rel=\"noopener\">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.<!--more--><br \/>\nFor 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.<br \/>\nSomething 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>\n<pre escaped=\"true\" lang=\"ruby\" line=\"0\">&lt;%= form_tag :id =&gt; 'myid' %&gt;\n&lt;%= text_field 'blog', 'name', :class =&gt; 'myclass' %&gt;\n&lt;\/form&gt;\n<\/pre>\n<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\" rel=\"noopener\">adjustment<\/a> to the Akelos source which made it possible to do:<\/p>\n<pre escaped=\"true\" lang=\"ruby\" line=\"0\"> &lt;%= link_to _'translated text', :action =&gt; 'about' %&gt;\n    or\n &lt;%= something 'name', :vals =&gt; { 'plain text', _'translated text', _'translated text with %variable' } %&gt;<\/pre>\n<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>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,24],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-hobby","category-php"],"_links":{"self":[{"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":0,"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"wp:attachment":[{"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.186.249\/index.php\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}