Monday, May 24. 2004
Today I released new versions of two of my XML packages at PEAR. This first is XML_Util 0.6.0, which provides a feature requested by Sebastian: in XML_Transformer, he needs to create an attribute from an array, without replacing the entities in the array values. Furthermore XML_Util increases in performance, as PEAR.php is not needed (and thus not included), until an error occures.
The second release is XML_Serializer 0.10.0: I fixed a small bug and added a new feature, which allows you to define how an array is serialized (i.e. if some of the values should be used as attributes). This feature has been requested quite often, so finally it's here.
Tuesday, May 18. 2004
Five minutes ago, I uploaded the developer documentation on patTemplate to our site.
This documenation explains, how to extend patTemplate without touching the original code. It covers variable modifiers, input- and output filters, template cache, readers, custom tags, etc. To sum it up, here you'll find all you need to know, if you plan to add some features to our favorite templating engine.
Monday, May 17. 2004
I just released XML_DTD 0.4.2, which contains some bug fixes, that have been laft over from Tomas. I adopted this package, until Tomas will be able to work on it again.
Furthermore, I released a new beta version of XML_Parser, which provides a new class XML_Parser_Simple. This class is a simplified version of XML_Parser, as it allows you to handle the whole tag, including the enclosed CDATA. All you have to do, is create an elementHandler that will process the tag. This handler will receive three parameters: tagname, array containing all attributes and the included character data.
This is suitable for a lot of scenarios, as it's common practice to build an element stack when using a SAX parser. An example is included in the package, feel free to play with it.
I'm not talking about __clone() here!
In his newest tutorial, Harry Fuecks suspected that I managed to somehow clone myself to get all the work done. But I have to disappoint you, there is no
<?PHP
$schst = &Schmidt::factory( 'Stephan' );
?>
The secret is, that pat, our friendly dog, does all the work and I receive the praise. But I guess I deserve the praise, as it can be really hard work to teach a mammal the principles of object oriented programming.
And to close the circle, if you are interested in reading and writing XML, I highly recommend Harry's tutorial " Instant XML with PHP and PEAR::XML_Serializer" over at SitePoint.com.
Today the latest issue of the German "PHP Magazin" has been released. As in every May issue, the focus is on Content Management with a huge overview of PHP powered CM systems.
Furthermore it features an article on Harry's XMLPull implementation in PHP as well as an article by Sebastian that explains how to build your own PHP on Windows platforms.
I contributed again, by writing a introductory article ( available online) on application configuration which explains how to use parse_ini_file() and the packages PEAR::Config and patConfiguration.
A list of all included articles is available online.
Saturday, May 15. 2004
DevShed published a new tutorial by Vikram Vaswani on my PEAR package XML_Serializer. The article " Serializing XML with PHP" explains how to use the PEAR class, which is able to create XML documents from any PHP datasource like objects or arrays.
XML_Serializer also provides a matching XML_Unserializer, that is able to read the XML documents and return data structures. It allows you to easily create and read RSS feeds or any other XML document.
Today I finally recieved my copy of MYSQL - The complete Reference by Vikram Vaswani, author of " XML and PHP" and several tutorials over at Devshed.
The book deals with everything you ever wanted to know about MySQL but were afraid to ask, starting with a very short introduction to databases in general and the architecture of MySQL. The Vikram talks about MySQL installation and configuration before he shows you how to actually use MySQL in the second part of the book.
He explains SQL basics as well as all functions, datatypes and operators that MySQL provides. This part of the book also explains newer features of MySQL like subqueries and transactions. Part 3 of the book focuses on the administration of the database server and delves into security issues as well as performance optimization and the replication features of MySQL.
The last part is for developers that want to use MySQL from their applications and explains the MySQL API for C, Perl and of course PHP.
I'll post an in-depth review as soon as I've finished reading, but at a first glance the book looks excellent, like Vikram's other work.
Monday, May 10. 2004
Although I recently released patTemplate 3.0.0beta1 I'm still working on new features and plugins for patTemplate. My newest two projects do not touch the main code, which is in a feature freeze.
Inspired by John's IntSmarty, I thought about implementing I18N functionality in patTemplate and came up with a solution that really resembles the one, John implemented for Smarty. To create multi-lingual websites, you just have to enclose the strings you want to translate in <patTemplate:Translate> tags. The Translate tag is a custom function, that's loaded as soon as it's used in a template, so it does not slow down the main engine. patTemplate will create a "default.ini" file, where it stores all strings that need to be translated and assigns each of these strings a unique ID. Now you copy this file to "<yourLang>.ini" and translate all strings. The next time you display the page, just set the language using $tmpl->setOption( 'lang', '<yourLang>' ); and patTemplate will use the correct language file. And in contrast to IntSmarty you do not have to know anything about the internals of patTemplate to develop this, as patTemplate allows youto register callback objects (dubbed custom functions) for new tags.
You may view the example and the source online. Again a big hug to John for inspiring me to do this.
Another thing I started implementing is a compiler for patTemplate, which is just a subclass and behaves exactly like patTemplate. I only spent a few hours on this project, so it's not working like it should, but basic functionality is there and it will support nearly all features of patTemplate once it's finished.
With the stable release of patTemplate and its subpackages, Smarty will get some serious competition, as patTemplate provides the features all you Smarty users have been complaining about.
Friday, May 7. 2004
We are now providing a mirror for the english version of the PEAR Manual. It is available at pear.php-tools.net/peardoc/. The mirror may not look as nice as the original (argh will have to adjust the stylesheets), but it is rebuilt every two hours instead of only once a week.
That means if you are looking for up-to-date information, you should check our built, if the docs you are looking for are not available at the PEAR website.
This will also help you, if a are a contributor to the manual and would like to see your changes online. The log is also avaibale, so if the built contains errors, you may view the error log at pear.php-tools.net/peardoc.log.
Tuesday, May 4. 2004
You do not have to wait any longer, it's finally here! A lot of people probably thought it would never happen, but today I released the first beta of the completely refactored patTemplate 3.0.0.
The list of all new features is nearly endless, so I just mention the most important features here, see the news file for a list of all changes.
- split into several small modules for performance
- support for input- and output-filters
- support for variable modifiers (PHP functions and custom classes)
- support for modulo template
- able to read from any datasource
- able to read PHPLib templates
- support for new tags: comment and var
- support for custom tags
- support for template cache
- flexible namespace
- new built-in conditions: __first and __last
- and many more...
This release is a beta release, please test it and report bugs after downloading it from our site.
Monday, May 3. 2004
Our powerful, but not yet released, form management package patForms got a lot of new features during the last week. On friday, I created a subpackage called patForms_Storage, which allows you to automatically store data in and retrieve data from various datasources without writing anything on your own. So far, I've implemented datastorages for CSV and PEAR DB. You may specify a set of primary keys, so the storage container is able to determine whether the entry has to be updated or added. The code that you have to use looks like:
$storage = &patForms::createStorage( 'DB' );
$storage->setStorageLocation( 'mysql://pat:@localhost/pat', 'patForms_Storage' );
$storage->setPrimaryField( array( 'user', 'email' ) );
$storage->setFieldMap( array(
'user' => 'user',
'pass' => 'password',
'email' => 'email'
)
);
$form->setStorage( $storage );
You can easily combine this with another subpackage I've been working on: patForms_Creator, which builds forms for databases or anthing else. So you get your form that is connected to a database table within 5 minutes of work.
Another thing I've added are observers, that may be attached to the form or elements of the form. I'm using those to change attributes of the elements, actually I'm changing the CSS class of an element if an error occured.
To test patForms, get it from our CVS or download a daily snapshot. We'll soon publish some online examples, followed by an alpha version of patForms.
|