Jonathan Snook's Blog: Easier Static Pages for CakePHP 1.2
524053
Jonathan Snook has posted about a method he's using to make the creation/use of static pages in a CakePHP application (or website) simpler.   Traditionally in a CakePHP application, to do static pages you have two options: use the built-in Pages controller or set up an empty action in a controller.   Feeling that neither of these two options met how he wanted things to work, Jonathan (and Nate Abele) developed a class that extends the error handler in the CakePHP framework to handle "missing" actions and controllers. This means that, if an unknown controller/action combo is called, this script will check in its correct location (in the structure of the site) and try to find it to render it.
599048
On his blog today, Mike Naberenzy has posted about something new that's just been released - Horde_Routes:   I'm pleased to announce the first release of Horde_Routes, a new URL mapping system for PHP 5. This package provides classes for mapping URLs into the controllers and actions of an MVC system, inspired by Ruby on Rails.   They came up with the system because they "wanted RESTful routing, named routes, sophisticated matching, PHP 5 E_STRICT, and extensive test coverage" and nothing else seemed to meet them all. Horde_Routes includes features like route recognition and generation, named routes, being PHP 5 E_STRICT compliant and has a comprehensive unit test suite. Right now, the Routes system is in a beta stage but should be quickly moving to stable.
341644
The guys over on Sanisoft.com dropped us a line today to let us know about a new entry on their blog showing how to implement attach and detach behaviors in CakePHP models.   Behaviors are one of the best things that have been added to CakePHP 1.2, they allow you to add functionality to your models in a very elegant and modular fashion. They also promote a lot of code reuse. Perhaps a real life example would illustrate it better.   They show how to create behaviors that can perform a save() call on an image with the backend code doing all the hard work. They create the two methods - dontActAs and nowActsAs - to make attaching and detaching simple.
360849
On the Zend Developer Zone today, there's this new tutorial that looks at making the move from PHP4's object-oriented programming up to the "more complete obejct model of PHP5" - specifically with the Decorator design pattern.   While working on a project I realized one particular solution was a pretty good way to demonstrate the decorator design pattern together with some of PHP5's features, including abstract classes, interfaces, type hinting, the final keyword and the visibility of properties and methods. This article is intended for those of you who, like myself, are moving from object-oriented programming, including some use of design patterns, in PHP4, to the more complete object model of PHP5.   He sets up a scenario about the development of an online pizza ordering system to show how to "decorate" a pizza with each of the toppings on a list (instead of having to list out every pizza in every possible topping combination). Of course, all of the code is included and explained so you understand exactly what's happening. Finally, there's a demonstration of its usage - a simple call that grabs the stock level/name/cost of each of the items in stock (pizza combinations).
756797
Here's what was popular in the PHP community one year ago today:PHP-Tools Blog: New releases of patTemplate and patFormsPrism-Perfect.net: PHP Tag Cloud TutorialPHPit.net: Building a simple MVC system with PHP5Alan Knowles' Blog: Code Reviewing.Nefarious Designs: Object-Oriented PHP Part 1: DefinitionWaxJelly Blog: Using PHP to make a MySQL "abstraction layer"php|architect: Introduction to PHPUnitNefarious Designs: Object-Oriented PHP Part 2: RelationshipsJohn Mertic's Blog: PHP Windows Installer updated for PHP 5.2.0RC2 and moreDevShed: Reading, Writing and Creating Files in PHPPHPKitchen: Seagull 0.6.0 ReleasedThinkPHP Blog: Make the download of large files with PHP (and lighty) very easyPeter Goodman's Blog: Observers and DispatchersRyan Malesevich's Blog: WP Plugins: WP-ChunkPHP.net: PHP 5.1.6 Released
733011
Felix Geisendorfer has a "quick hit" tip posted to his blog today on using HTML 4.0.1 in your CakePHP 1.2 installation.   This is just a little tip for those of you who dislike their xhtml to end up as tag soup and still prefer to send out Html 4.01 strict. Here is how to make all helper functions in Cake 1.2 output Html 4.01 compliant markup instead of xhtml.   The helper he's created just loops through the entire $tags array and does a replace on the greater-than sign to add a slash to make it compliant.
715490
On the Sanisoft blog today, there's a quick tutorial demonstrating how to create a multilingual application with the CakePHP framework:   There are basic two ways to creating a multilingual app in traditional PHP [...] CakePHP V1.2 is the framework which allows you to take the quantum leap of using gettext like functionality with minimum of hassles and at the same time address the common problems which a PHP programmer faces while creating multilingual apps.   They give an example of a simple translation of a sentence (including working with .po files). They show how to integrate the example string, create the .po file with the translation and configure the language to pull the correct phrasing to display to the page.
247721
Continuing on from this previous post talking about Javascript in CakePHP applications, Felix Geisendorfer hands out more tips in this new blog entry targeted mainly at users of the jQuery Javascript library.   While the old solution was nice to manage the JS of a smaller application, this one is ment to structure your JS even in bigger projects. To make this possible I decided to go with a loose (MV)C pattern.   He gives an example of using a SiteController in connection with a CalendarController to help populate the information for the calendar.
22956
The Bakery has four new items posted today - articles and tutorials on a few different subjects:   Multiple files upload in v1.2 - "Are you wondering how to upload more than one file by CakePHP? Today I wrote this solution." TuneShout.com: Music Downloads and CakePHP - "How I used CakePHP to build TuneShout.com, a socially controlled online music network and store." Zip Component - "I am currently building a web 2.0 implementation of Bake that allows users to create their entire application in a friendly web environment and than creates a zip on demand." Uuid Behavior - "I have a requirement to use UUID's as primary keys. I was initially using MySQL triggers to call uuid() on insert but in the end decided a behavior makes more sense. This behavior adds a UUID to the field specified in your models."   Check back with The Bakery
769389
Latest PHPClasses.org Releases:Class TreeviewPHP User ClassDHTMLDumpSalatCSV Parse and ReadRSAsmb4phpClient infoTrue Singleton ClassRounded Border Table Generator
416010
The IBM developerWorks site brings the community another great tutorial today, this time looking at the CakePHP framework and the creation of a simple application with it.    In "Cook up Web sites fast with CakePHP, Part 1: Adding related information and services", they build a sample application (Tor) from the ground up (installation guide and all) that will take in a username and password on a login page. Their goal is to show you how much time you could safe by using the framework over just the usual library-based (or procedural) programming methods.   You will need to be a bit familiar with PHP and the Model/View/Controller design pattern before you get started here, but if you have that down, you can just jump right in. You'll also either need to register with the site or log in with your account information to get to the good stuff.
575210
Popular posts from PHPDeveloper.org for the past week:PHP-Coding-Practices.com: How I Turned A Slow Array Sort Into A Quick One Using Quicksort AlgorithmZend Developer Zone: PHP Abstract Podcast Episode 4: Planning ProgrammingWeb Development Blog: Save bandwidth with PHProxy and ip2nationJob Posting: Assembleron Ltd Seeks PHP 5/MySQL/Ajax Developers (Reading, UK)PÃ¡draic Brady's Blog: Complex Views with the Zend Framework - Part 6: Setting The TerminologyThe Bakery: Four New Articles - Load Balancing, Request Info, UUID Behavior & Upload ThumbnailsCommunity News: PEAR Installer version 1.6.0 releasedChristopher Kunz's Blog: Building PHP with cURL and libmysqlclient5DevShed: Working with Prepared Queries with PDO Objects in PHP 5Secunia.com: rPath update for gd, php, php-mysql, and php-pgsql
739630
In his his latest blog entry, Felix Geisend&ouml;rfer makes a recommendation for anyone working with the CakePHP framework. He suggests doing something that most might avoid - diving into the source to find out how things work.   When hanging out in #cakephp I usally try to answer questions people have as good as I can. A lot of the times I have no idea what the answer is and in most cases the fastest way to find out is by looking at the core code. Ok, the manual is pretty decent these days and I would recommend most people to look for an answer in there first. But if you take the time to study the core code, you'll be able to answer almost any question by yourself, no matter if it has been answered somewhere before.   He talks about other advantages like finding those hidden, undocumented features already supported by the framework. Since this is the first part of the series, he just looks at how to get into the source. He starts off with the basic index.php file that comes installed with the distribution and a chunk of code that helps run the index file and is at the heart of how CakePHP works - the Dispatcher.
647066
DevShed has posted the second part of their (three part) series looking at the construction of a blogging application in PHP5. In this part, they look at how to handle the user's desire to input entries into the application via a HTML form.   In this second installment of the series, I'll show you how to expand the initial functionality of the already familiar "BlogProcessor" class so that it is capable of addressing all these (displaying all the entries, show the insert/update forms) issues.   They start with the simplest of the group - the displayBlogs method, outputting the full contents of the entries for the blog. Things get a bit tougher with the next step - creating the insert and update forms for pushing content into the database. Finally, they defined the header and footer functionality to make setting up the structure of the page simpler.
366821
Felix Geisendorfer has an interesting little solution posted to his blog today for those wanting to sync a Subversion repository over to a remote FTP folder without having to mess with external software (well, besides CakePHP, that is).   As the headline says, this time it's going to be my SVN/FTP Deployment Task written for the new Bake in CakePHP 1.2. It will not work with the Cake 1.1.x.x branch, and I currently do not have time to explain the procedure to work around this.   The key, in fact, is the new Bake that's included with this new version.  When combined with the code it will push the contents of the directory out to the remote server. There's even some included code to make a pseudo-install to your remote server.
703914
On his blog, Stuart Herbert has a quick tip showing how to mimic a feature of Ruby on Rails:   I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.   He admits his example isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
277396
Lukas Smith has posted his review of a book from Packt Publishing - "PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!"   Duane from Pakt asked me if I would be interested in reviewing a few books for them in my blog. I picked "Mashup Projects" from the list of just released books, since I am interesting in the topic and I am actually going to give a presentation at the internal "PHP Day" we are doing at Optaros in November.   He points out the good (good writing style, well-chosen examples) and the bad (a log list of errors and oversights in the code). He also talks about the contents of the book - the different examples and the final more major project. Overall though, he sees it as a good book, one that would be a good introduction to mashups for PHP developers (if you look past the formatting issues).