a programmer's best friend :: Entries from March 2005 |
Monday, March 7. 2005patTemplate 3.0.1 released
I just made a bugfix release of the patTemplate 3.0.x branch, which fixes some small notices and bugs that have been reported in the last few months. If you are using patTemplate 3.0.0 I recommend you to upgrade.
If you would like to test some of the new features I have added to patTemplate you may grab the latest snapshot of the 3.1.x series from snap.php-tools.net. Sunday, March 6. 2005patConfiguration 2.0.0b1 released
I finally managed to release a first public beta of my configuration reader patConfiguration.
Starting with this release it is now driver-based which keeps the codebase small and at the same time allows you to read and write XML, INI and WDDX files using the same API. The XML-reader is the most powerful driver as it allows you to define how you would like the tags to be handled. This means you can define that the tag <foo one="1" bar="totmato"/> should automatically be converted to an array that should contain the attributes of the tag as values. Of course you can also choose which types to use for the attribute values, so they get converted to booleans, floats, integers, strings, arrays or objects. To achieve this, patConfiguration provides a very easy-to-use built-in tag: <!-- define a new namespace -->Now that you've defined, how patConfiguration should interpret the tags, you may use them in your configuration: <shop:articles>Parsing this configuration is extremely easy: <?phpIf you worry about the overhead of parsing XML files on every request, you may want to switch-on the caching system which makes loading the configuration faster then reading it from PHP files. If you want to use your tag definitions in more than one file, just use external entities or xInclude tags, patConfiguration supports both, even in PHP4. After reading this XML-document with patConfiguration, you'll get the following array structure back: ArraypatConfiguration allows you to return the complete configuration or only parts of it, using a mixture of PHP's array snytax and a path to the desired value. If you'd like to see more features of patConfiguration in action, you may want to take a look at the online examples or download it from our site. If you are using PEAR 1.4.0 you may also get it from our PEAR-channel: $ pear channel-discover pear.php-tools.netIf you stumble upon a bug, please report it using our bugtracker. Friday, March 4. 2005PHP5-Client for Yahoo's Webservice API
Our new member Daniel Wiegand (wiegi) implemented a PEAR compatible client for Yahoo's new REST-based webservice API. From the Yahoo developer site: "Yahoo! Search Web Services allow you to access Yahoo content and services in your favorite programming languages. This means you can now build Yahoo directly into your own applications." By using Daniel's PHP5 client you do not need to worry about the protocol or the resulting XML format, everything is done in plain PHP:
<?PHPBesides searchWeb() the client provides more methods to use the different web services offered by Yahoo:
As Daniel has been using PHP5 all of these methods return a Services_Yahoo_Result object that provides methods to return the total number of search results but can be iterated like a normal object, thanks to SPL. This result object offers a lot more, as you can use it to fetch the next page using the same search parameters: <?PHPQuite cool, isn't it?You can take a loot at the sources at http://pear.php-tools.net/projects/Services_Yahoo/ or even download a PEAR installable package from http://pear.php-tools.net/projects/Services_Yahoo/Services_Yahoo-0.1.0.tgz (requires PHP5, XML_Serializer and HTTP_Request). We would have loved to propose this to PEAR, but there already is a draft for a Services_Yahoo package by Martin Jansen, but until now he hasn't showed any of his code. Hopefully Daniel and Martin could be working on a package together. |
php_network_getaddresses: getaddrinfo failed: Name or service not knownphp_network_getaddresses: getaddrinfo failed: Name or service not known |