php developer

› Alexander Netkachev's Blog: Programming a data layer classes

Alexander Netkachev has posted this quick tutorial with a few examples he's made for extending the Zend_Db_Table class from the Zend Framework.

He sets up the situation (complete with database table) and explains the creations of a "Users" extension to the Zend_Db_Table class. He shows how to set it up to work with your table name, and how to create a new user with the sample table provided.

He also demonstrates a simple validation wrapper around the functionality just to ensure that invalid data isn't passed in.

26/06/2006 2:45 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› DevShed: Searching and Replacing Nodes with SimpleXML in PHP 5 (Part 3)

DevShed has posted part three of their "working with SImpleXML in PHP5" series today, focusing this time on the searching and replacing of nodes within a loaded XML string.

So far, the couple of functions that I mentioned before actually do a good job of parsing simple XML files and strings. However, the "simpleXML" library has a few additional handy functions that I'd like to show you in this last tutorial. That said, in the next few lines, I'll be covering these functions, in order to demonstrate how to quickly search and replace nodes within XML data strings.

They start with some node comparison and locating the nodes inside of the XML (with a little help from XPath). Once they're found, they show how to replace the node itself with the asXML method PHP provides. Finally, they give a more "real life" example of how to blend it all together.

26/06/2006 2:13 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› SitePoint.com: Create Dynamic Images with ImageMagick

Over on SitePoint.com today, there's a new tutorial demonstrating an alternative to the usual GD library examples of working with images, opting instead for ImageMagick.

The key component for making dynamic images a reality on your site is an image manipulation program that's controlled by the code that generates your web pages. Even though this article uses PHP as the scripting language, other languages -- such as Perl and Ruby -- can be used just as easily, provided that the image manipulation program that you're considering has an application programming interface (API) for the chosen language.

He decided on ImageMagick for a few reasons, including that it's more supported by web hosts, it runs on Windows and Linux, and it's robust and powerful enough to handle everything from small to large tasks without missing a beat.

That said, he gets into the code, showing how a bit of PHP code can read in an image and spit back out information about it (height, width, etc), force a reduction of an uploaded image, scale down an image to fit a certian size, change it to a different type of image, and image rotation.

26/06/2006 1:48 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› Felix Geisendörfer's Blog: Welcome to the Dark Side of Plugins in CakePHP

CakePHP users out there looking to squeeze just a bit more out of their plugins might want to check out this new post over on Felix Geisendörfer's blog today. He shows how he's worked around two issues that have bothered him with the current framework setup - inter-plugin communication and filter callbacks.

He starts off by looking at the filter callbacks, looking to make "drag and drop-able" plugins for his setup. He notes that, right now, you'd have to call a plugin to perfom an action, making for a good bit of load depending on the application structure. It also means that you have to change the Controller to add a new plugin ("...which doesn't seem like a very RAD approach to me").

So in order to streamline such plugin callbacks, I created a function inside SpliceIt!, that allows plugins to hook into any AppController event, such as beforeFilter, afterFilter, beforeRender, etc. in order to make their own changes to the controller. So a Themes plugin can easily change the Controller::view and a Statistics plugin can make calls to a Model.

He gives the code for the function as well as an example of how to use it in your app.

Moving on, he looks at his next issue to overcome - inter-plugin communication:

Generally spoken Controller::requestAction() isn't a bad way to exchange data between controllers. It's a clean interface and you don't have to plan in advance what data should be exchangeable and what data should not. However, there are a couple problems with it.

His solution involves the creation of an entirely seperate ApiController pattern. Of course, he provides examples, specifically related to his SpliceIt! application.

26/06/2006 1:27 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› Community Crosstalk: Matthew O'Phinney & Scott Johnson on Dynamic Function/Method Calls

In two related posts from Scott Johnson and Matthew O'Phinney, there's a question about metaprogramming in PHP, specifically between the use of call_user_func, call_user_func_array, and variable function calls (as asked by Scott).

One of the characteristics of meta programming is lots and lots of dynamicism everywhere. So here's my php question: Is there a real difference between call_user_func versus call_user_func_array and the variable function syntax i.e. $function_name() ? As best as a quick experiment shows they seem to function the same although I did a quick hack / quick doc check as opposed to really drilling into it. Any efficiency benefits in doing it one way or another?

Matthew replies on his blog by running some benchmarks (and wondering why Scott didn't run his own).

Back to benchmarking. Scott asks, "Is there a real difference between call_user_func versus call_user_func_array and the variable function syntax i.e. $function_name()?"

The short answer: absolutely. The long answer? Read on.

He details what the differences are in the functionality (how they're used and all) as well as examples of their usage. He whips up a test class and function to go through different benchmarks, testing response times with the microtime functionality of PHP. He results aren't too surprising, but you'll have to check out his post to get the full details.

26/06/2006 1:14 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

bård farstad  eZ systems employee

› eZ publish conference pictures 2006

I have uploaded some pictures taken during the eZ publish confernece 2006.

eZ awards Trophy

26/06/2006 9:48 am (UTC)   Bård Farstad   View entry   Digg!  digg it!   del.icio.us  del.icio.us

tobias schlitt  eZ systems employee

› FrOSCon "eZ comonents" slides online

I just commited the slides from my recent talk "Enterprise PHP development with eZ components". It should be online in a couple of minutes here.

25/06/2006 4:56 pm (UTC)   Tobias Schlitt   View entry   Digg!  digg it!   del.icio.us  del.icio.us

knut urdalen

› eZ Conference 2006 summary

Ok, I didn’t manage to blog yesterday but I’ll post a short summary of the eZ Conference as a whole. The conference was held in Ibsenhuset in Skien. The conference started yesterday with a keynote presentation of the whole eZ systems company and an announcement of their plans about what they call the eZ platform. eZ publish 3.8 [...]
24/06/2006 1:27 am (UTC)   Knut Urdalen   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› ZD Net Asia: Keep your options open with FTP file uploads

On the ZD Net Asia site today, there's a quick look at using the FTP functionality that can be compiled into PHP to create a method to upload files.

Take file upload, for example. Sure, you can do it the traditional way, using HTTP file upload and transferring the file directly to a location on your Web server's disk. Or you can do it the more exotic way, and use the FTP protocol to upload in a two-step process: from your local disk to a Web server, and then to an FTP server.

Reams have already been written about HTTP file upload, which is why this brief tutorial focuses on FTP-based file uploads instead (in the example that follows, though, you'll see both in action). Note that this tutorial assumes that you have a working PHP/Apache installation, with both HTTP file upload and FTP functions active.

They have three steps for you to take to get their example up and working:

  • checking that you have the access rights to get on the server
  • creating an upload form
  • code the PHP upload processor

The form and PHP code are provided, so there's no reason to worry on that count. The biggest issue is whether or not you have the FTP support compiled into your PHP installation. From there, it's just a few simple function calls away from pushing the uploaded files contents out to a remote server.

23/06/2006 8:51 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

php developer

› WebProNews.com: Form Checking - Verifying Name Using PHP Ereg

On WebProNews.com, there's a brief tutorial on using regular expressions, specifically for filtering "names" entered by users.

One important use of Regular Expressions (Regex) is to verify fields submitted via a form. In this article, we attempt to write an expression that is able to verify the user's first name, middle name, last name or just names in general.

The expression should allow names such as "Mary", "Mr. James Smith" and "Mrs O'Shea" for example. So the challenge here is to allow spaces, periods and single quotation marks in the name field and reject any other characters.

Their examples use the preg_* functions in PHP to work, first looking for any invalid characters in the string(s), then amending it to ensure that there aren't any numbers involved either. The few lines of code it takes are included as well.

23/06/2006 2:40 pm (UTC)   PHP Developer   View entry   Digg!  digg it!   del.icio.us  del.icio.us

eZ publish™ copyright © 1999-2005 eZ systems as