<?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>Tue, 21 May 2013 12:12:24 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Extending Twig Templates: Inheritance, Filters, and Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/19467</guid>
      <link>http://www.phpdeveloper.org/news/19467</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial for the <a href="http://twig.sensiolabs.org/">Twig</a> templating users out there showing you how to <a href="http://phpmaster.com/extending-twig-templates-inheritance-filters-and-functions/">extend your templates</a> via inheritance, filters and functions - all abilities already built in to the tool.
</p>
<blockquote>
When working within an MVC architecture, it's common to use a template library to populate the dynamic content of our views. There are dozens of such libraries available for PHP, but Twig is one of the standouts because of the ability to extend core features with custom implementations. In this article we'll explore how Twig templates can be extended using template inheritance, filters, and functions.
</blockquote>
<p>
He starts first with some of the common limitations of templating frameworks (extension) and how Twig gets around this. He shows the use of the "extends" keyword and the "block"/"endblock" for splitting up the page into reusable chunks. He also shows how to use filters and functions in your Twig tags, allowing for more customized content and functionality for your output.
</p>
Link: http://phpmaster.com/extending-twig-templates-inheritance-filters-and-functions/]]></description>
      <pubDate>Tue, 16 Apr 2013 11:05:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen: Sending an HTML with text alternative email with ZendMail]]></title>
      <guid>http://www.phpdeveloper.org/news/18689</guid>
      <link>http://www.phpdeveloper.org/news/18689</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has a <a href="http://akrabat.com/zend-framework-2/sending-an-html-with-text-alternative-email-with-zendmail/">quick tutorial posted</a> to his site today showing you how to send an email with the ZendMail component of the Zend Framework 2 that contains HTML but provides a plain text backup in the same message.
</p>
<blockquote>
Sending a multi-part email with ZendMail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!
</blockquote>
<p>
The rest of the post is the code you'll need to send a simple email with a text and HTML body sections, configure the headers (to, from, etc) and the "multipart/alternative" header to make the HTML or plain text switching work correctly.
</p>]]></description>
      <pubDate>Fri, 02 Nov 2012 10:26:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Overriding Strategy Logic - The Template Method Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/18514</guid>
      <link>http://www.phpdeveloper.org/news/18514</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial posted talking about <a href="http://phpmaster.com/overriding-strategy-logic-the-template-method-pattern/">the Template Method Pattern</a> to help make some sense (and make easier to use) your implementation of the Strategy pattern.
</p>
<blockquote>
This bring us back to the question whether it's feasible to eliminate duplicated strategy logic via Inheritance rather than switching over to plain Composition. Indeed it is, and the clean up process can be conducted through an ubiquitous pattern known as <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Method</a>. [...] Simply put, there's a base class (usually an abstract one), which declares a concrete method (a.k.a. the template) responsible for outlining the steps or hooks of a certain algorithm. Most of the time the base type provides boilerplate implementation for some of those steps and the remaining ones are delegated to subclasses.
</blockquote>
<p>
The subtypes then override the base's functionality and extend it with their own. They show an example of this by making a jQuery image slider (using <a href="http://jquery.malsup.com/cycle/">this plugin</a>) , an "AbstractCycleSlider" class and two subclasses for two other types - "FadeSlider" and "ScrollSlider", each outputting their own HTML. It also shows how to implement a slider using a <a href="http://www.zurb.com/playground/orbit-jquery-image-slider">different plugin</a> and output both in the same script.
</p>]]></description>
      <pubDate>Tue, 25 Sep 2012 08:58:01 -0500</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[NetTuts.com: An Introduction to Views & Templating in CodeIgniter]]></title>
      <guid>http://www.phpdeveloper.org/news/18201</guid>
      <link>http://www.phpdeveloper.org/news/18201</link>
      <description><![CDATA[<p>
NetTuts.com has a new tutorial that will interest the CodeIgniter developers out there about using <a href="http://net.tutsplus.com/tutorials/php/an-introduction-to-views-templating-in-codeigniter/">views and templates</a> in your CI applications.
</p>
<blockquote>
Views are a key ingredient in any MVC application, and CodeIgniter applications aren't any different. Today, we're going to learn what a view is, and discover how they can be used to create a templating solution for your CodeIgniter projects. The first part of this tutorial will educate complete beginners to CodeIgniter on what a view is, and how to use them in a typical application. The second half will discuss the motivations for finding a templating solution, and guide the reader through the necessary steps for creating a simple, yet effective templating library.
</blockquote>
<p>
They introduce you to some of the fundamentals behind views, templating, using multiple views and using the templating to push values out to the site.
</p>]]></description>
      <pubDate>Mon, 09 Jul 2012 12:09:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: 5 Inspiring (and Useful) PHP Snippets]]></title>
      <guid>http://www.phpdeveloper.org/news/18162</guid>
      <link>http://www.phpdeveloper.org/news/18162</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial that <a href="http://phpmaster.com/5-inspiring-and-useful-php-snippets/">shares some useful PHP snippets</a> that you could use in your development.
</p>
<blockquote>
"X PHP Snippets" type articles abound on the Internet, so why write another one? Well, let's face it… the PHP snippets in them are generally lame. Snippets that generating a random string or return $_SERVER["REMOTE_ADDR"] for the IP Address of a client really aren't that interesting and are of modest usefulness. Instead, here's five snippets that you'll no doubt find interesting and useful, presented along with the problems that inspired them. I hope the creativity in many of them inspire you to write better and more creative code in your own day-to-day endeavors.
</blockquote>
<p>Their "five tips" are about:</p>
<ul>
<li>Generating CSV files from an array of data
<li>Autoloading classes (in a PSR-0 way)
<li>Parsing data with the <a href="http://php.net/unpack">unpack</a> function
<li>Templating in HTML (creating a "View" object)
<li>Using file_get_contents as a cURL Alternative
</ul>]]></description>
      <pubDate>Mon, 02 Jul 2012 10:58:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: How to Build PHP 5.4 Applications with Visual Studio]]></title>
      <guid>http://www.phpdeveloper.org/news/18155</guid>
      <link>http://www.phpdeveloper.org/news/18155</link>
      <description><![CDATA[<p>
On Dzone.com today there's a new post showing you how to build <a href="http://dotnet.dzone.com/articles/how-build-php-54-applications">PHP applications with Visual Studio</a> based on PHP project templates.
</p>
<blockquote>
Developing web applications with PHP is cool, especially when you have the right development tools and even with more features added in PHP 5.4. But each time I left the comfort of Intellisense in Visual Studio to develop PHP applications using Zend or Netbeans for PHP, I was not always satisfied with those IDEs' code complete features. Thus, I decided to search for any available plugin that will provide this feature in Visual Studio.
</blockquote>
<p>
The plugin used is on from <a href="http://www.jcxsoftware.com/">Jcx.Software Corp</a>. It adds in the PHP templates and Intellisense support for PHP code completion. He also shows how to set up an IIS server to work with it to make it easier to test your application.
</p>]]></description>
      <pubDate>Fri, 29 Jun 2012 08:26:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[James Morris' Blog: Parsing HTML with DOMDocument and DOMXPath::Query]]></title>
      <guid>http://www.phpdeveloper.org/news/18145</guid>
      <link>http://www.phpdeveloper.org/news/18145</link>
      <description><![CDATA[<p>
In the latest post to his blog <i>James Morris</i> looks at <a href="http://blog.jmoz.co.uk/domdocument-domxpath-html-parsing">using XPath's query() function</a> to locate pieces of data in your XML.
</p>
<blockquote>
The other day I needed to do some html scraping to trim out some repeated data stuck inside nested divs and produce a simplified array of said data. My first port of call was SimpleXML which I have used many times. However this time, the son of a bitch just wouldn't work with me and kept on throwing up parsing errors. I lost my patience with it and decided to give DomDocument and DOMXpath a go which I'd heard of but never used.
</blockquote>
<p>
He includes a code (and XML document) example showing how to extract out some content from an HTML structure - grabbing each of the images from inside a div and associating them with their description content.
</p>]]></description>
      <pubDate>Wed, 27 Jun 2012 10:19:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: So You Want to Accept Credit Cards Online?]]></title>
      <guid>http://www.phpdeveloper.org/news/18091</guid>
      <link>http://www.phpdeveloper.org/news/18091</link>
      <description><![CDATA[<p>
On NetTuts.com they're posted a new tutorial about <a href="http://net.tutsplus.com/tutorials/other/so-you-want-to-accept-credit-cards-online/">using the Stripe service</a> to accept credit cards on your site. Thanks to some handy libraries they provide, integration is a relatively simple process.
</p>
<blockquote>
Until recently, accepting credit cards on a website was expensive and complicated. But that was before <a href="https://stripe.com/">Stripe</a>: a radically different and insanely awesome credit card processing company. Today, I'll show you how to start accepting cards in 30 minutes or less - without spending a dime.
</blockquote>
<p>They step you through the whole process you'll need to get the full flow set up:</p>
<ul>
<li>Install an SSL Certificate (on your server)
<li>Create an Account
<li>Create Your Payment Form
<li>Collect The Form Values
<lI>Request a Token
<li>Create a Server-Side Script
</ul>
<p>
Screenshots of the Stripe interface, HTML, Javascript and PHP code are all included - everything you need to make the simple card handling work. One of the keys to how Stripe deals with credit cards is that you provide it the card info, it gives you a token. Your app uses this to work with the card instead of storing the card information in your database (also making it more secure).
</p>]]></description>
      <pubDate>Thu, 14 Jun 2012 09:30:25 -0500</pubDate>
    </item>
  </channel>
</rss>
