<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 01:34:56 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Anthony Ferrara: On Templating]]></title>
      <guid>http://www.phpdeveloper.org/news/18874</guid>
      <link>http://www.phpdeveloper.org/news/18874</link>
      <description><![CDATA[<p>
In <a href="http://blog.ircmaxell.com/2012/12/on-templating.html">this latest post</a> to his site <i>Anthony Ferrara</i> take a look at templating in web applications - more specifically as it deals with his experience with the <a href="http://mustache.github.com/">Mustache</a> templating engine.
</p>
<blockquote>
I've been playing around with tempting engines a lot lately. For a recent project, I needed the ability to re-use the same template set in both JS and PHP (coupled with the History API, providing seamless dynamic behavior, yet still having raw content pages). Realistically today, there's only one choice for that sort of requirement: <a href="http://mustache.github.com/">Mustache</a>. I've learned a lot while playing with Mustache, and it's really changed my entire viewpoint on presentation layer construction.
</blockquote>
<p>
He briefly gives an overview of "the past" of templating in PHP (including a mention of <a href="http://www.smarty.net/">Smarty</a>) and how templating tools - like <a href="http://mustache.github.com/">Mustache</a> - have helped to improve the situation, especially when it comes to the separation of presentation and processing. As an alternative, there's also a mention of the <a href="http://twig.sensiolabs.org/">Twig</a> templating engine in the comments, another popular option from the Symfony project.
</p>]]></description>
      <pubDate>Tue, 11 Dec 2012 11:50:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Dev.Umpirsky.com: Use Poedit to Extract Translations from Twig Templates]]></title>
      <guid>http://www.phpdeveloper.org/news/18441</guid>
      <link>http://www.phpdeveloper.org/news/18441</link>
      <description><![CDATA[<p>
In <a href="http://dev.umpirsky.com/use-poedit-to-extract-translations-from-twig-templates/">this new post</a> to the Umpirsky.com development blog, they show you how to use <a href="http://www.poedit.net/">poedit</a> to extract translations from Twig templates.
</p>
<blockquote>
By default, Poedit does not have the ability to parse Twig templates. In Twig documenation there is a simple example which shows how to extract translations. This can work with few modifications, but I wanted to make reusable tool which will allow you to parse Twig templates just like you do with plain PHP templates.
</blockquote>
<p>
The result is the <a href="https://github.com/umpirsky/Twig-Gettext-Extractor">Twig-Gettext-Extractor</a> that's set up inside Poedit as a parser command for "*.twig" files. This automatically extracts the information so that the editor can read the data from the template.
</p>]]></description>
      <pubDate>Tue, 04 Sep 2012 11:34:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Dean Clatworthy: Theming/styling error messages in Symfony 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18424</guid>
      <link>http://www.phpdeveloper.org/news/18424</link>
      <description><![CDATA[<p>
For the Symfony2 users out there, <i>Dean Clatworthy</i> has a handy tip to help you customize the output of your application a bit more - a method for <a href="http://www.deanclatworthy.com/2012/08/theming-error-messages-in-symfony-2/">styling the error messages coming from forms</a> using a custom template.
</p>
<blockquote>
I spent a large portion of my day today trying to customize the HTML produced by Symfony 2 for form errors. The documentation has a section on how to do this, but for the life of me, I could not make it work. Here is a working, re-usable solution.
</blockquote>
<p>
His solution involves the creation of a template in your "/Resources/views/Form/" directory that contains a Twig template for the error set output. This is then applied in your view using an additional parameter on the error output tag, including this new template from the "Form" directory. This sort of styling could also be applied if you needed custom elements with their own layouts in your forms as well.
</p>]]></description>
      <pubDate>Thu, 30 Aug 2012 11:40:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Symfony2... to Twig or not to Twig...]]></title>
      <guid>http://www.phpdeveloper.org/news/18024</guid>
      <link>http://www.phpdeveloper.org/news/18024</link>
      <description><![CDATA[<p>
In <a href="http://www.reddit.com/r/PHP/comments/uatm1/symfony2_to_twig_or_not_to_twig/">this recent post</a> on Reddit.com a developer of a Symfony2 application asks, "to <a href="http://twig.sensiolabs.org/">Twig</a> or not to Twig</a> for templating in his views.
</p>
<blockquote>
Hey there... long time Symfony 1.x enthusiast here, finally getting my feed wet with Symfony2. I pose this question to the Symfony2 developers out there: Who's using Twig for templating? Why or why not?
</blockquote>
<p>
The answers tange from the obvious "yes" and "no" options out to suggestions that even using templating languages are a bad idea. A few point out that the "separation of concerns" as a valid reason while others discount them by dismissing the "designers don't have to learn a language" myth that seems to still be so popular. There's also a few mentions of other templating projects like <a href="http://www.smarty.net/">Smarty</a> and <a href="http://phpsavant.com/">Savant</a>.
</p>]]></description>
      <pubDate>Wed, 30 May 2012 11:32:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Project: Gitlist - A Git Repository Viewer (based on Silex & Twig)]]></title>
      <guid>http://www.phpdeveloper.org/news/17977</guid>
      <link>http://www.phpdeveloper.org/news/17977</link>
      <description><![CDATA[<p>
<i>Klaus Silveira</i> has submitted a project he's been working on to make browsing through git repositories a bit simpler with a local tool - <a href="https://github.com/klaussilveira/gitlist">gitlist</a>.
</p>
<blockquote>
GitList is an elegant and modern web interface for interacting with multiple git repositories. It allows you to browse repositories using your favorite browser, viewing files under different revisions, commit history, diffs. It also generates RSS feeds for each repository, allowing you to stay up-to-date with the latest changes anytime, anywhere. GitList was written in PHP, on top of the <a href="http://silex.sensiolabs.org/">Silex</a> microframework and powered by the Twig template engine. This means that GitList is easy to install and easy to customize. Also, the GitList gorgeous interface was made possible due to <a href="http://twitter.github.com/bootstrap/">Bootstrap</a>.
</blockquote>
<p>
Since it's just a PHP-based application, installing it is as easy as cloning the source to a web-accessible directory and setting up a "config.ini" file with your settings. You can find out more about this project based on the popular Silex microframework <a href="https://github.com/klaussilveira/gitlist">on its GitHub page</a>.
</p>]]></description>
      <pubDate>Fri, 18 May 2012 09:45:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Organzing Slim Framework Applications]]></title>
      <guid>http://www.phpdeveloper.org/news/17542</guid>
      <link>http://www.phpdeveloper.org/news/17542</link>
      <description><![CDATA[<p>
One of the more popular PHP microframeworks right now is <a href="http://www.slimframework.com/">Slim</a> and <i>Chris Hartjes</i> has <a href="http://www.littlehart.net/atthekeyboard/2012/02/14/organizing-slim-framework-apps/">a new post to his blog</a> about a good way he's found for organizing applications that use this handy tool.
</p>
<blockquote>
I've never really used a microframework in PHP before. I used <a href="http://flask.pocoo.org/">Flask</a> for a Python <a href="https://github.com/chartjes/liesitoldmykids">project</a> that I did to experiment with using Google App Engine. The principles seem to be quite similar (although I will admit that having decorators in PHP would be ineresting) but the trade-off with a microframework is that you usually have to figure out an application layout for yourself.
</blockquote>
<p>
He also uses the <a href="http://pimple.sensiolabs.org/">Pimple</a> dependency injection container, <a href="http://twig.sensiolabs.org/">Twig</a> templating and <a href="http://packagist.org/about-composer">Composer</a> for package management. He describes how he got it all set up - organizing the code so Composer could understand it, creating the Twig templates directory and creating some of his default routes.
</p>]]></description>
      <pubDate>Wed, 15 Feb 2012 08:57:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Twig extension]]></title>
      <guid>http://www.phpdeveloper.org/news/17151</guid>
      <link>http://www.phpdeveloper.org/news/17151</link>
      <description><![CDATA[<p>
In a new post from <i>Derick Rethans</i> he talks about <a href="http://derickrethans.nl/twig-extension.html">an extension version</a> of Twig, the popular <a href="http://twig-project.com">templating engine</a> from the creators of the Symfony framework.
</p>
<blockquote>
A while ago, Fabien asked me to have a look at porting one of Twig's slowest methods, TwigTemplate::getAttribute(), into a PHP extension. It is a complex method that does a lot of different checks and look-ups. Fabien's benchmarks showed that this method was responsible for quite a large amount of time. On top of that, it didn't seem that it could be optimised any further as PHP code itself.
</blockquote>
<p>
He points to <a href="https://github.com/derickr/twig-ext">the twig-ext extension</a> that's a reworked version of the "getAttribute" method from the tool and the performance gain (about 15%) it gives. Compiled templates will automatically call this new method in the extension. This update has already been merged into <a href="http://github.com/fabpot/Twig">the main Twig repo</a>.
</p>]]></description>
      <pubDate>Mon, 21 Nov 2011 08:35:39 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Smashing Magazine: Getting Started With PHP Templating]]></title>
      <guid>http://www.phpdeveloper.org/news/17005</guid>
      <link>http://www.phpdeveloper.org/news/17005</link>
      <description><![CDATA[<p>
On the Smashing Magazine site today there's a new post <a href="http://coding.smashingmagazine.com/2011/10/17/getting-started-with-php-templating/">introducing you to templating</a> in PHP applications. They cover both the creation of a simple, custom templating library as well as using a more widely known too - <a href="http://twig-project.org">Twig</a>.
</p>
<blockquote>
In this article, we'll cover how to separate the view of your PHP application from its other components. We'll look at why using such an architecture is useful and what tools we can use to accomplish this. [...] To fully benefit from this article, you should already know how to write and run your own PHP scripts on a Web server (i.e. using Apache).
</blockquote>
<p>
They start with the very basics of templating, mostly pointing out how it reduces the dependency of having layout code directly in your application's logic. It makes things easier to reuse and makes for better code structure in the long run. They mention other templating engines like <a href="http://www.smarty.net/">Smarty</a>, <a href="http://phptal.org/">PHPTAL</a> and <a href="http://www.twig-project.org/">Twig</a>, but focus in on the last for their code samples. They show basic templating, making reusable templates, applying filters and working with simple control structures.
</p>]]></description>
      <pubDate>Tue, 18 Oct 2011 09:15:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: Rapid Application Prototyping in PHP Using a Micro Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/16818</guid>
      <link>http://www.phpdeveloper.org/news/16818</link>
      <description><![CDATA[<p>
On NetTuts.com today there's a new tutorial posted about <a href="http://net.tutsplus.com/tutorials/php/rapid-application-prototyping-in-php-using-a-micro-framework/">using a microframework for prototyping an application</a> you may not need a full stack framework to get running. Their examples are based on the <a href="http://www.slimframework.com/install">Slim</a> framework.
</p>
<blockquote>
Let's face it: we all have great ideas for a web application. Whether you write them down on paper or remember them using your eidetic memory, there comes a point when you want test whether or not your idea is really viable. In this tutorial, we'll use a micro framework, a templating language and an ORM to rapidly develop an application prototype.
</blockquote>
<p>
There's an introduction to help you get <a href="http://www.slimframework.com/install">Slim</a>, some <a href="https://github.com/codeguy/Slim-Extras">extras</a>, <a href="http://www.twig-project.org/installation">Twig</a> templating and <a href="https://github.com/j4mie/paris">Paris</a> and <a href="https://github.com/j4mie/idiorm">Idorm</a> set up and working happily together. There's code included for bootstrapping the application, creating a few routes, building models and using them to pull data from the database. They also create an "admin" area for their sample blog application, building an "add article" form and protecting it with a simple login system. You can <a href="http://nettuts.s3.amazonaws.com/1041_phprapidprototyping/code.zip">download the source</a> if you'd like to see it all working together.
</p>]]></description>
      <pubDate>Tue, 06 Sep 2011 09:56:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Joris de Wit's Blog: Extending different layouts for Ajax requests in Twig, Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/16784</guid>
      <link>http://www.phpdeveloper.org/news/16784</link>
      <description><![CDATA[<p>
<i>Joris de Wit</i> has a (very) <a href="http://jorisdewit.ca/2011/08/27/extending-different-layouts-for-ajax-requests-in-twig-symfony2/">quick post</a> about a handy tip he found about switching layouts easily with <a href="http://twig-project.org">Twig</a> in his Symfony2-based application - a handy ternary sort of switch that can detect when something's an Ajax request.
</p>
<blockquote>
I just learned about the 'app' global variable in twig. It's very handy for loading a special layout for ajax requests.
</blockquote>
<p>
The "app" variable allows you get get back at some of the settings of your application and check on special things like the isXMLHttpRequest in his example. For more information about Twig and how you can add it to your application, check out <a href="http://www.twig-project.org/documentation">Twig-Project.org</a>. Using it's as simple as adding a phar.
</p>]]></description>
      <pubDate>Mon, 29 Aug 2011 11:39:34 -0500</pubDate>
    </item>
  </channel>
</rss>
