<?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>Thu, 23 May 2013 10:25:24 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Multiple PHP versions set-up]]></title>
      <guid>http://www.phpdeveloper.org/news/17092</guid>
      <link>http://www.phpdeveloper.org/news/17092</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> has a new post today looking at a method for <a href="http://derickrethans.nl/multiple-php-version-setup.html">setting up multiple PHP versions</a> on the same machine and switch between them with a little help from some simple bash scripts.
</p>
<blockquote>
For many of my projects (both <a href="http://derickrethans.nl/projects.html">hobby</a> and <a href="http://derickrethans.nl/who.html#derickrethansltd">commercial</a>) I need to support many different PHP configurations. Not only just different PHP versions, but also debug builds, ZTS builds and 32-bit builds. In order to be able to test and build extensions against all those different PHP configurations I have adopted a simple method that I'm sharing with you here.
</blockquote>
<p>
Using <a href="http://derickrethans.nl/files/php-build.sh.txt">this script</a> he can tell his system to pull the latest version of any release from SVN and try to compile it. The trick is putting each of them into a different directory under /usr/local. He uses another small shell function (with a function called "pe()") that sets up the pathing to the right release, complete with its own locations for PEAR/PECL and a php.ini.
</p>]]></description>
      <pubDate>Mon, 07 Nov 2011 09:14:00 -0600</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>
    <item>
      <title><![CDATA[Martin Psinas' Blog: Switching to PDO]]></title>
      <guid>http://www.phpdeveloper.org/news/16674</guid>
      <link>http://www.phpdeveloper.org/news/16674</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Martin Psinas</i> talks about some of his pains experienced with <a href="http://psinas.com/index.php?blogid=8">upgrading his code to use PDO</a> instead of the mysql extension for database interaction.
</p>
<blockquote>
I read not too long ago that the mysql library in PHP is <a href="http://news.php.net/php.internals/53799">being deprecated</a> as of v6.0 in favor of mysqli or PDO, so of course I had to update all of my database code keep on top of things. I spent about 5 or 6 hours over the course of 2 days familiarizing myself with the new syntax and updating my code offline. Without any testing, I decided I could go ahead and push the code "live" because I'm just that over-confident sometimes, although I did make a backup in case anything went wrong (or so I thought).
</blockquote>
<p>
Two problems jumped out immediately - a SQL error caused by <a href="https://bugs.php.net/bug.php?id=40740">this bug</a> and the other being a problem with preparing his statement inside of a session handling method.
</p>]]></description>
      <pubDate>Thu, 04 Aug 2011 10:17:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: One-Step Symlink Switch]]></title>
      <guid>http://www.phpdeveloper.org/news/14997</guid>
      <link>http://www.phpdeveloper.org/news/14997</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has <a href="http://www.lornajane.net/posts/2010/One-Step-Symlink-Switch">a handy tip</a> you can use in deploying your (linux-based) PHP applications - a one-step symlink switch that can make toggling between deployed versions of your code simple.
</p>
<blockquote>
When I deploy an application, which is almost invariably a PHP application, I like to put a whole new version of the code alongside the existing one that is in use, and when everything is in place, simply switch between the two. As an added bonus, if the sky falls in when the new version goes live, the previous version is uploaded and ready to be put back into service.
</blockquote>
<p>
The single command avoids having to remove a current symlink and recreate it, possibly causing issues if something happens in between. Instead she uses the "mv" (move) command to push the current symlink over to a new location. Reducing the process to one step also minimizes the risks of deployment.
</p>]]></description>
      <pubDate>Fri, 20 Aug 2010 10:03:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Michelangelo van Dam's Blog: Zend Framework context switching for HTML content]]></title>
      <guid>http://www.phpdeveloper.org/news/14362</guid>
      <link>http://www.phpdeveloper.org/news/14362</link>
      <description><![CDATA[<p>
<i>Michelangelo van Dam</i> has a new post to his blog today looking a a method for doing some <a href="http://www.dragonbe.com/2010/04/zend-framework-context-switching-for.html">context switching</a> in his Zend Framework application to use jQuery in his app's static HTML output.
</p>
<blockquote>
I had already build my apps using static HTML output generated by <a href="http://framework.zend.com/">Zend Framework</a>, so how could I add this richness to my apps without refactoring most of my code ? Simple, by using Zend_Controller_Action_Helper_ContextSwitch, <A href="http://framework.zend.com/manual/1.10/en/zendx.jquery.html">ZendX_JQuery</a> and some minor adjustments to my view scripts.
</blockquote>
<p>
He includes some code (that's confirmed to work with ZF 1.10.3) using the contextSwitch method on a helper object that adds in the "json" type for the contexts that can be used for the responses. Then a new template is added for the type (like index.json.phtml for the json output). Make a change or two to your bootstrap file to add in the right jQuery helpers and your view is as simple as calling "$this->jQuery".
</p>]]></description>
      <pubDate>Fri, 16 Apr 2010 08:43:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Adding Multi-Language Support to Web Applications with PHP and PEAR]]></title>
      <guid>http://www.phpdeveloper.org/news/12404</guid>
      <link>http://www.phpdeveloper.org/news/12404</link>
      <description><![CDATA[<p>
On the Zend Developer Zone today a <a href="http://devzone.zend.com/article/4469-Adding-Multi-Language-Support-to-Web-Applications-with-PHP-and-PEAR">new tutorial</a> has been posted about multi-language translation for your site with PHP and the <a href="http://pear.php.net/package/Translation2">Translation2</a> PEAR package.
</p>
<blockquote>
If you're using PHP, adding multi-language support to a Web application is quite easy, especially since the PHP Extension and Application Repository (PEAR) includes some ready-made code to help you get started. And that's where this article comes in. Over the next few pages, I'll introduce you to PEAR's Translation2 package, and show you how you can use it to add multi-language support to your application.
</blockquote>
<p>
You'll need to have everything up and running (including an install of the PEAR package) before getting started. The tutorial shows how to set up database tables and sample data to reference with a basic "Hello World" script as well as a few more complex examples involving user input and creating a cross-language menu for a sample site.
</p>]]></description>
      <pubDate>Fri, 24 Apr 2009 14:48:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Debuggable Blog: Code Insults Round 1 - Why switch blocks are dumb]]></title>
      <guid>http://www.phpdeveloper.org/news/11305</guid>
      <link>http://www.phpdeveloper.org/news/11305</link>
      <description><![CDATA[<p>
In the first of his "<a href="http://debuggable.com/posts/i-will-insult-your-code!:48ac91d1-ca78-4e95-ad66-1e854834cda3">I will insult your code</a>" series, <i>Nate Abele</i> looks at <a href="http://debuggable.com/posts/code-insults-round-1---why-switch-blocks-are-dumb:4901d363-d210-482c-9794-65bd4834cda3">this submitted code</a> and points out that maybe blocks of switch/case statements aren't such a good idea after all.
</p> 
<blockquote>
The entire submission is actually two files, which together comprise a console script for interacting with a web service (the names of the entrants have been withheld to protect the identities of the guilty). Rather than examine the full entry, we're going to take a look at one part which I find comes up fairly often: switch block overkill.
</blockquote>
<p>
The example he's talking about has a switch statement with eight different cases under it, most of them just setting two properties on the current class. Its used ot map command line parameters to their correct properties. <i>Nate</i> suggests a bit different method - still using switch/case but pulling the properties to be assigned from an array of options rather than hard-coding them into the evaluation.
</p>]]></description>
      <pubDate>Wed, 29 Oct 2008 08:48:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christian Stocker's Blog: FOTD: REFLECTIONCLASS()->NEWINSTANCEARGS($ARGS) is "slow"]]></title>
      <guid>http://www.phpdeveloper.org/news/11041</guid>
      <link>http://www.phpdeveloper.org/news/11041</link>
      <description><![CDATA[<p>
<i>Christan Stocker</i> has posted a <a href="http://blog.liip.ch/archive/2008/09/18/fotd-reflectionclass-newinstanceargs-args-is-slow.html">finding of the day</a> that he ran across and wanted to share to help out other developers out there:
</p>
<blockquote>
For okapi we needed to have a function which loads any class with any number of arguments. This is not so easy in PHP as it looks like [...] Since 5.1.3 you can use the reflection extension to do this much nicer.
</blockquote>
<p>
The difference comes in at about half the time for both side of the examples - with the switch and via reflection.
</p>]]></description>
      <pubDate>Thu, 18 Sep 2008 13:17:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Debuggable Blog: How to bend Cake's Model::find() method to your needs]]></title>
      <guid>http://www.phpdeveloper.org/news/10463</guid>
      <link>http://www.phpdeveloper.org/news/10463</link>
      <description><![CDATA[<p>
New on the Debuggable blog, <i>Tim Koschutzki</i> has <a href="http://www.debuggable.com/posts/implementing-different-types-for-cake%27s-model::find()-method:485030de-4778-456e-8400-44d84834cda3">posted a method</a> to get the fund() method in the CakePHP framework's models to bend to your will.
</p>
<blockquote>
CakePHP allows you to use your own "find-types" for the Model::find() methodology. Those of your who are familiar with the find() method know that there are currently four types in the core: 'list', 'all', 'first' and 'count'. However, sometimes it is nice to specify your own type.
</blockquote>
<p>
He shows an example of the end result - a find() call with a custom type that automagically gets translated correctly. His script overrides and enhances the usual find call in an extended object (extended from AppModel) that uses a switch/case statement to define the custom types and their find() search calls.
</p>]]></description>
      <pubDate>Mon, 23 Jun 2008 12:08:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint WebTech Blog: Give Your Visitors a Rough Time]]></title>
      <guid>http://www.phpdeveloper.org/news/9744</guid>
      <link>http://www.phpdeveloper.org/news/9744</link>
      <description><![CDATA[<p>
In <a href="http://www.sitepoint.com/blogs/2008/03/06/give-you-visitors-a-rough-time/">a new post</a> to the Web Tech blog over on SitePoint, <i>Toby Somerville</i> has posted something he calls "RoughTime" - his method for displaying a more "human friendly" output of a timestamp.
</p>
<blockquote>
When asked the time, we generally don't need to be military accurate with our response [...] we generally communicate the approximate time. i.e. 'its nearly ten' or 'its just gone half past three'. Yet on the web, time is generally shown as '12:24:13 AM', or similar '" not very visitor friendly.
</blockquote>
<p>
His <a href="http://www.sitepoint.com/blogs/2008/03/06/give-you-visitors-a-rough-time/">RoughTime</a> uses two switch statements to map the hour and minute values to different strings. For example, minutes between 15 and 20 become "quarter past" and the hours are changed over from numeric versions to their word counterparts.
</p>]]></description>
      <pubDate>Thu, 06 Mar 2008 08:44:00 -0600</pubDate>
    </item>
  </channel>
</rss>
