DotVoid.com: Reordering nested sets using PHP and Javascript
495510
On the DotVoid blog today, Danne Lundqvist has posted about a problem he had - creating parent/child style data and displaying it as nested sets with the combination of PHP and Javascript. He outlines two different methods but only chooses one to run with.   The first method is "adjancency", a method that involves storing a parent ID in each node and recursing to find the related ones. He goes with a different solution, however - a "nested set". This method stores the data in terms of where it's located on the tree (layers from right, layers from left, etc).   Last night I was working on an application that display a full tree where the user must be able to to drag and drop nodes to reorder the tree. The problem is that it is much more difficult to insert or reorder the tree using the nested set model.   This was particularly effective in solving his problem, making a reogranizable listing that could be manipulated via a Javascript interface (the MooTree script from MooTools). Hi sPHP solution is included.
692839
On his "Yet andother PHP blog" today, William Candillon shares a script he's written up to create a visualization of the parse tree of a bit of PHP source code.   I wrote this xslt stylesheet to visualize the parse tree of a PHP source code. The stylesheet can actually convert any XML tree to graph in the dot format interpreted by Graphviz.   His code is a simple seven line script that outputs a nice, clean tree structure image of how the process flows. He includes links to all of the source and files he used to create the tree image.
732440
The International PHP Magazine has posted results from their latest PHP community poll as voted on by visitors to their site. The question for this poll asked developers what they thought, of the choices on the list, was the most common mistake that PHP developers make.   Coming in at number one by an overwhelming lead was "Not escaping entities and SQL input" (a definite problem indeed) with the next highest option, "Not using a Framework" a full twenty percent lower. The next two options were closer (descending) - "Using old PHP versions" and "No or little use of Object Orientation".   There's a new poll this week for your consideration - this time asking which stage, of the five options, should come first in the development cycle of a typical content management system. Head on over and cast your vote today!
152445
Latest PHPClasses.org Releases:Flash MessagesRSS and Atom Feeds Processing APImabp::tagCloudUltimate MySQLerror_managerSingly Linked ListChinese Encode ConvertphpSortableASCII Art GeneratorPSPLMultiselectNiftyCubeAmazon ECS Webservicesimple Email ClassPHPDance
139742
In this new blog entry, Sebastian Bergmann talks about two bits of functionality that PHP has that bring it a bit closer to a full functional language - array_map and array_reduce.   Just like Python, PHP is not a full-fledged functional language, but it supports some very useful functional idioms such as map and reduce. A blog posting by Scott Moonen on Functional Python prompted me to write this posting on PHP's array_map() and array_reduce() functions that apply callback functions to arrays.   He includes examples of each (in the functional context) showing how you can map callbacks to the array values, one that adds one to each number in the array and the other that combines the values and returns the sum.
318761
DevShed ramps up another new series today with this new article giving developers a look at working with object-oriented programming through the eyes of design patterns. It's another excerpt from the George Schlossnagle book "Advanced PHP Programming".   This chapter provides an overview of the advanced OO features now available in PHP. Some of the examples developed here will be used throughout the rest of this book and will hopefully serve as a demonstration that certain problems really benefit from the OO approach.   The article lays down the foundation for the more complex information to come. It introduces object-oriented programming briefly, and talks about some of the handy features of it - like inheritance, static attributes and methods.
723192
Here's what was popular in the PHP community one year ago today:Yet Another Web Development Blog: A PHP Developer Spends a Week with PythonZend Developer Zone: AJAX Chat Tutorial Pt 5: Javascript, Sending Chat Messages, Screen Name ChangesWebDevLogs: ClickHeat - PHP+JS heatmapTemplora.com: Basic PHP Script SecurityVinu Thomas' Blog: Modifying your MySQL databases to be UTF-8 compliantJeff Moore's Blog: PDO versus MDB2AnyExample.com: PHP password generationJason Palmer's Blog: Zip Code To LocationThe Bakery Blog: A gift for all to enjoySara Golemon's Blog: PHP-2006: A look backMatthew O'Phinney's Blog: Overloading arrays in PHP 5.2.0Davey Shafik's Blog: A Year in Review (2006)Jacques Marneweck's Blog: Smarty tip for including multiple javascript filesphp|architect: Final days of our iPod Training Promo!Alexander Netkachev's Blog: About Eclipse PHP IDE php.ini location
448776
Sara Golemon describes the path she took in a search for an OpenID library to work with in PHP. The trip took her through both PEAR and PECL with no promising results. Heading off to a Yahoo! search she comes up with one good result - Auth_OpenID.   Now, granted, this is the first OpenID system I've looked at, and I haven't really dug into it in depth, but I've got to say, this is some clean, well written code and the author clearly understands the maths involved (or at least fakes it shockingly good).   Knowing this, she asks "why isn't this in PEAR" if it's so well-structured and useful? It works with any version of PHP from 4 up and is smart enough to adapt itself to whatever the structure of your application might be.   There's also some great comments on the post where it's explained why the library isn't in PEAR, another OpenID package for PHP and suggestions for alternate distribution methods (PEAR channel).
30477
Latest PHPClasses.org Releases:aFilesSmiley GeneratorlangMerge PicturesKeyword SuggestFuseBox ManagerSite Guide
14108
On the SitePoint PHP Blog today, Troels Knak-Nielsen has written up a post concerning the current state of functional programming in PHP.   With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealized potential hidden within?   He looks at a few different aspects of functional programming and sees how well PHP fits into them (like dynamic dispatch, binding a variable to a function and an implementation of currying for a function). This last option is the only "true" functional feature that PHP can realistically handle.
494480
DevShed charges right ahead with its emphasis on design patterns in PHP with a new start of a new series today that looks at the Flyweight pattern.   Among the considerable variety of structural design patterns that can be implemented with PHP 4 (and PHP 5, by the way), there's one in particular that deserves special attention. It's easy to apply in the context of a given web application, and it offers remarkable functionality when it comes to preventing the unnecessary instantiation of different classes. This two-part series covers that pattern.   As they explain, the Flyweight pattern helps to keep your code light and simple by preventing the instantiation of unneeded objects and resources. They go with a HTML form example, illustrating how to prevent a submit button or an input button's class to be reinitialized every time a new form field is needed.
230802
In a new post to his blog today, Danne Lundqvist shares his method for creating a blog aggregator (in the style of the planet-planet sites) to re-aggregate all of the feeds back ou tinto one.   Lately I have begun to get more and more annoyed with my feed reader. I use a simple feed reader which lack most features except for subscribing to and reading feeds. The one thing that annoys me the most is that it can't aggregate several feeds into one feed. Yesterday I finally decided to scratch that itch.   His method uses the Zend Framework to accomplish the goal - and "the whole website logic (both model and controller) is about 200 lines of code". There's no exception or error handling in it, but it works and the Zend_Feed module works well to grab just about any kind of feed.
217574
As mentioned by Ed Finkler, there's a list of signs your PHP needs refactoring from Soledad Penades.    I have had to go through a php application recently which has given me more than one headache and has required me to use all my possible patience. While working with it, I thought This is good material for an article, so that nobody else does the same in the future, and nobody else will need to experience the same displeasure as I have had to.   So here are the signs your PHP application needs a serious refactoring, right now    Included in the list are things like:   Uses global variables Everything's an array The neverending switch Interface inconsistency   It hits on one of the thing that bugs me too, the problem of "Brackets galore" - so many subarrays that you have to resort to three or more sets of bracketed keys to get to the value you want. It's bad enough trying to follow someone else's code without having to "trace down" an array to figure out which of the values they're talking about.
689365
Stefan Mischook has updated his "Object  Oriented PHP for Beginners" tutorial with more new steps bringing the count up to 11 of the 20 planned steps.   Based on an article I wrote for a web design magazine; the tutorial is presented as a series of simple steps where I walk the reader through the process of building objects while at the same time, exposing them to basic object oriented concepts.   Eventually, he will be producing videos similar to these for all of the sections to help make things easier for the beginners out there.
449834
Sebastian Bergmann has posted the results of some benchmarking on the compilation he's done on the branches of PHP from version 3.0 all the way up to 5.3-CVS.   As people keep asking me for an update to my previous benchmarks (PHP / GCC / ICC Benchmark, PHP 5.1 / GCC Benchmark (Update), and PHP 5.1 Performance, I quickly ran a new benchmark today.   He rendered the results out into a series of charts defining the number of total seconds taken for the compile and how long each of the components took. It's impressive to see how much of a jump there was between the 3.0 series and 4.3.   He also includes his compile settings (and machine information) as well as the numbers for the results if you'd like to graph them out yourself.
536363
Matthew O'Phinney has posted the slides from a New York PHP User Group meeting that Mark de Visser (of Zend) and he spoke at:   Mark presented information on Zend's development stack and toolset (which I entirely missed, as I was still in transit), and I came in to give an overview of Zend Framework.   Matthew posted the slides right to his blog. They're in a browser-based slideshow system that will launch wen you double-click on the index file.
743840
Chris Shiflett has posted his own recap of the (just passed) php|works conference up in Toronto over on his blog.   I've been traveling non-stop since php|works, so I haven't had a chance to reflect on the conference, what I learned, who I met, and things like that. (Zak has been doing a good job of this lately, and I'd like to follow his lead.) I've probably forgotten more than I remember, but this is my recap.   Included in the things he mentions are:  The people he was able to meet (like Joshua Eichorn and Sebastian Bergmann) The talks he gave ("Truth about XSS" and "Agile PHP Testing") His interview with Cal Evans of the Zend Developer Zone The PHP 5 Certification and Wez Furlong's "Not PDO" talk