<?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, 19 Jun 2013 02:52:47 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Rasmus Larsson: Building a template engine in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19655</guid>
      <link>http://www.phpdeveloper.org/news/19655</link>
      <description><![CDATA[<p>
<i>Rasmus Larsson</i> has a recent post to his site showing how to <a href="http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php/">build a basic templating engine</a> in PHP that uses the "__toString" to help render the result.
</p>
<blockquote>
Possibly the most common sign of bad code is tight coupling, especially between logic and presentation. It might seem like a good idea to print out the HTML while the data is being generated, but it more often than not leads to a big incoherent mess of tangled code. [...] While PHP makes it unnecessarily easy to write shitty code it also provides a lot of ways to avoid it. I'll use this post to show you how ridiculously easy it is to create a template engine in PHP in three easy steps.
</blockquote>
<p>
He includes the sample code for a "Template" class and shows the combination of <a href="http://php.net/export">export</a>ing variables and output buffering to return the resulting template populated with values. The "__toString" method makes it so that you can just <a href="http://php.net/echo">echo</a> out the object and get the results.
</p>
Link: http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php]]></description>
      <pubDate>Fri, 31 May 2013 11:11:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: The MVC Pattern and PHP, Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19302</guid>
      <link>http://www.phpdeveloper.org/news/19302</link>
      <description><![CDATA[<p>
PHPMaster.com has posted the <a href="http://phpmaster.com/the-mvc-pattern-and-php-2/">second part of their MVC series</a>, introducing you to the Model/View/Controller design pattern. If you want to catch up, part one <a href="http://phpmaster.com/the-mvc-pattern-and-php-1/">is here</a>.
</p>
<blockquote>
Welcome to part 2 of this two-part series discussing MVC and PHP, where we'll discuss some of the considerations one must make when using an MVC architecture. If you've come straight to this article without reading part 1 first, I encourage you to head back and have careful read as this one will assume that you've read and understand everything it discussed.
</blockquote>
<p>
He talks about some of the things more involved in making a MVC framework including routing and URL formats and working with templates. Sample code is included for the route handling, model/controller relationship and view classes for the templates.
</p>]]></description>
      <pubDate>Tue, 12 Mar 2013 11:19:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: The MVC Pattern and PHP, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/19274</guid>
      <link>http://www.phpdeveloper.org/news/19274</link>
      <description><![CDATA[<p>
If you're new to the world of PHP frameworks, there's one acronym that might confuse you if you don't understand the structure - MVC. In <a href="http://phpmaster.com/the-mvc-pattern-and-php-1">this new tutorial</a> on PHPMaster.com today introduces you to the MVC (Model/View/Controller) design pattern and how it's commonly implemented in PHP.
</p>
<blockquote>
The Model-View-Control (MVC) pattern, originally formulated in the late 1970s, is a software architecture pattern built on the basis of keeping the presentation of data separate from the methods that interact with the data. In theory, a well-developed MVC system should allow a front-end developer and a back-end developer to work on the same system without interfering, sharing, or editing files either party is working on. [...] In this article, I will go the basic principles of MVC, a run through the definition of the pattern and a quick example of MVC in PHP. This is definitely a read for anyone who has never coding with MVC before or those wanting to brush up on previous MVC development skills.
</blockquote>
<p>
He starts with an introduction of the overall structure of the pattern, how each part talks with the others. He then talks about each piece in a bit more detail and provides some code examples for some very basic MVC classes. There's no routing or anything connected to them like there would be in a framework - it's just the classes taking the others in as parameters.
</p>]]></description>
      <pubDate>Tue, 05 Mar 2013 13:21:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Andrew Podner: Lithium: Building Views Using Layouts]]></title>
      <guid>http://www.phpdeveloper.org/news/19176</guid>
      <link>http://www.phpdeveloper.org/news/19176</link>
      <description><![CDATA[<p>
<i>Andrew Podner</i> has written up a new post for his site today about <a href="http://unassumingphp.com/lithium-building-views-using-layouts/">building views/layouts in Lithium</a> and make the maintenance of your application simpler in the long run.
</p>
<blockquote>
The last time I wrote about the <a href="http://lithify.me/">Lithium framework</a>, the focus was on getting information out of a MySQL database.  Once you have that information, in many cases you will want to show it to the user.  In this installment, we are going to look at how Lithium implements layouts for your output in an effort to improve reusability of code, which ultimately improves the developer's ability to quickly get applications up and running and it makes maintenance down the road that much easier.
</blockquote>
<p>
He talks about the basic structure of an application (on the file system) and where the layouts and views live inside it. He includes a sample layout that defines areas for things like title, scripts, character set and main content. Code is also included showing how to use it in your application. There's also a bit about setting up a default layout in your "_init" method if you'd like to use it across the entire application.
</p>]]></description>
      <pubDate>Wed, 13 Feb 2013 11:54:04 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Robert Basic: Working with custom view helpers in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18468</guid>
      <link>http://www.phpdeveloper.org/news/18468</link>
      <description><![CDATA[<p>
In his latest post <i>Robert Basic</i> looks at <a href="http://robertbasic.com/blog/working-with-custom-view-helpers-in-zend-framework-2">working with custom view helpers</a> in your Zend Framework 2 application and shows how to implement a simple one to display a simple greeting.
</p>
<blockquote>
I took the skeleton [Zend Framework 2] application, made it even skinnier by throwing out some (for me) unneeded parts and just put it all besides my old ZF1 code. [...] The first problem I ran into was using custom view helpers, especially view helpers that are more general and don't fit into one specific module. Where to put the code? How to access them in views? The second problem was how to access the service manager from a view helper? And the third problem was how to tell the helper to use a specific value when inside a specific module?
</blockquote>
<p>
He includes a simple example - the greeting helper - and shows where to place it in the application structure, how to work with the service locator inside it and how to set up some module-specific views inside.
</p>]]></description>
      <pubDate>Wed, 12 Sep 2012 09:27:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Patterns for Flexible View Handling, Part 2 - Using Decorators]]></title>
      <guid>http://www.phpdeveloper.org/news/18448</guid>
      <link>http://www.phpdeveloper.org/news/18448</link>
      <description><![CDATA[<p>
PHPMaster.com has posted the second part in their series looking at design patterns in handling views in your framework of choice. In <a href="http://phpmaster.com/flexible-view-manipulation-2/">this new article</a> they focus on the decorator pattern, using additional functionality to augment the results from the view being rendered.
</p>
<blockquote>
It's also feasible to manipulate views in fairly flexible fashion by appealing to the niceties of a few other patterns as well, including the rather underrated <a href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorators</a>. If you're wondering in what parallel universe Decorators get along with views, in this part I'll be showing how to put them to work side by side in nice orchestration to bring to life yet another view module.
</blockquote>
<p>
They create a simple example where an HTML element (based on an interface) is rendered - a span tag - with content passed in on creation. They take this same logic and transfer it over to the View handler, making handlers for difference pieces of the content (outer and inner). These decorators are then passed in the data from the view and rendered in order.
</p>]]></description>
      <pubDate>Wed, 05 Sep 2012 11:18:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Patterns for Flexible View Handling, Part 1 - Working with Composites]]></title>
      <guid>http://www.phpdeveloper.org/news/18421</guid>
      <link>http://www.phpdeveloper.org/news/18421</link>
      <description><![CDATA[<p>
PHPMaster.com has started up a new series today with <a href="http://phpmaster.com/flexible-view-manipulation-1/">the first part</a> of a set of tutorials looking at design patterns that can be used in the handling of your views to make them more effective and easier to maintain.
</p>
<blockquote>
To overcome your skepticism [of an easy to use, flexible view system], in this two-part tutorial I'll show you how to implement from scratch a couple of customizable view handling modules by sinking our teeth into the goodies of the Composite and Decorator patterns.
</blockquote>
<p>
He starts off by creating a foundation to work from - a basic View class that takes in data, allows for the setting of a template and combines it all together when "render()" is called. He then takes this example and applies the Composite pattern and creates interfaces for the template, container and view, implements them and shows how to attach views to other views. Each of these views is then rendered when the main "render()" method is called and the output is appended.
</p>]]></description>
      <pubDate>Thu, 30 Aug 2012 08:32:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Evan Coury: Creating a simple view helper in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18353</guid>
      <link>http://www.phpdeveloper.org/news/18353</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post today showing how to <a href="http://blog.evan.pro/creating-a-simple-view-helper-in-zend-framework-2">create a simple view helper</a> in a Zend Framework 2 based application.
</p>
<blockquote>
This post will show you how to create a simple view helper in Zend Framework 2. In this example, our view helper will simply return the full, absolute URL of the current page/request.
</blockquote>
<p>
Code for the example is included, showing how to pull in the namespaced dependencies and extend the AbstractHelper to define the simple view helper. The "__invoke" method is used to handle the functionality and the configuration for the helper is defined in the Module's "getViewHelperConfig" options. You can find out more about the View Helpers in Zend Framework 2 in <a href="http://packages.zendframework.com/docs/latest/manual/en/modules/zend.view.helpers.html">their manual page</a>.
</p>]]></description>
      <pubDate>Mon, 13 Aug 2012 13:24:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matt Cockayne: Bootstrapping ZF2 Forms]]></title>
      <guid>http://www.phpdeveloper.org/news/18260</guid>
      <link>http://www.phpdeveloper.org/news/18260</link>
      <description><![CDATA[<p>
In <a href="http://devincharge.com/bootstrapping-zf2-forms/">this recent post</a> to his site, <i>Matt Cockayne</i> shows you how to bootstrap your forms in a Zend Framework 2 application (as defined in a class).
</p>
<blockquote>
A brand spanking new Forms component has been rolled out with <a href="https://github.com/zendframework/zf2">ZF2</a>. The long and the short of this new component meant that I had the opportunity to hand roll a new way of making my forms work with <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>. So, a little tinkering, a quick <a href="https://github.com/zendframework/zf2/pull/1893">pull request</a> to <a href="https://github.com/zendframework/zf2">ZF2</a> to allow the definition of arbitrary options and I <a href="https://github.com/zucchi/Zucchi/tree/master/src/Zucchi/Form/View/Helper">came up with some useful View Helpers</a> that can be dropped into a project and used.
</blockquote>
<p>
He includes the code for the sample class ("MyForm") and highlights the "bootstrap" portions of each element's configuration and walks you through some other handy features of his helpers: auto-rendering forms, a "row" helper and a "collection" helper to help organize the form structure.
</p>]]></description>
      <pubDate>Mon, 23 Jul 2012 11:07:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lee Davis' Blog: Zend Paginator Example]]></title>
      <guid>http://www.phpdeveloper.org/news/17840</guid>
      <link>http://www.phpdeveloper.org/news/17840</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Lee Davis</i> gives an example of <a href="http://www.duckheads.co.uk/zend-paginator-example/">using the Zend Framework's pagination functionality</a>, complete with some CSS to style it a bit better than the defaults.
</p>
<blockquote>
One of the reasons why zend framework has been so popular is due to all the hard work put in to make sure components are extremely configurable. Sure there are default behaviours, but nothing is assumed and anything that needs to be overwritten or reconfigured can be. A strong emphasis on configuration over convention means you'll never be lumbered with code that just can't be changed. <a href="http://framework.zend.com/manual/en/zend.paginator.usage.html">Zend Paginator</a> is one of the smaller components of Zend Framework that allows you to get a simple
paginator up and running on your listings or search pages in a matter of minutes. 
</blockquote>
<p>
Included in the post is a cut-and-pasteable view that creates the Previous/Next links as well as including the first/last page numbers and a few around the current page.
</p>]]></description>
      <pubDate>Thu, 19 Apr 2012 10:31:29 -0500</pubDate>
    </item>
  </channel>
</rss>
