Sep
11
2007

domxml-php4-to-php5

(Add / View Comments) (0)Tuesday, September 11, 2007 - 10:52:27 pm
(Posted Under: Development, Web Development)
For a couple of months now (since installing PHP5 - along side PHP4, of course [wink]), I've wanted to add PHP5 support into Photobox. Which in particular means a DOM compatibility layer, as the DOMXML stuff is the major problem in Photobox (and, well, anything I've written that uses DOMXML and XSLT).

I initially started a compatibility class to handle portability between PHP4 and PHP5 (a whole three methods, whoah! [wink]), which fell to the wayside, with work and life getting in the way. With the latest bout of development I've tried to rekindle that. Less so with that full blown class outright, but with some of the data abstraction work I've been doing over the past month.

On getting stuck with DOMNode::get_root(), which appears to be an undocumented method (it's in my code, and has always worked, however there is no reference to it existing in the php.net documentation), I did a Google search, and low and behold came across some really lightweight and nice PHP4 -> PHP5 DOMXML and XSLT code.

XML : from PHP4 domxml to PHP5 dom - Doc Alex and XML : from PHP4 xslt to PHP5 xsl - Doc Alex.

Oddly I've spend a minor amount of time looking for something like that, and haven't found anything that fits the bill. The one time I'm just looking for a function description to do what I want and I find exactly what I want! Ironically also, the code doesn't provide the get_root() method, bizarre that I came across it searching for that!

Dropping that into Photobox and changing my .htaccess file to use PHP5 works like a charm. Well, after fixing some bugs in my XSL (which were blatent, but the PHP4 XSLT parser never even acknowledged!). Pretty sweet. The whole PHP5 thing is a little less daunting, having found this.

In addition, I've figured that it'll be a good opportunity (given my modifications) to play around with vendor branches in CVS. Tonight I've gone through and added both of those modules, sanscon and PHP_JPEG_Metadata_Toolkit to a third party module, probably for the first time using vendor branches correctly! Finally a vendor tag and release tag on import makes some sense! (And side note, why does EVERY CVS guide say you might as well use 'import' to first add your project to CVS? Really doesn't seem that right now!)

In anycase, I must say I'm quite happy with this code. And to find it - as much as I almost always prefer writing stuff myself, this is one instance where I'm more than happy to use third party code. (Well, PHP JPEG Metadata Toolkit is another very true example of that! [wink]).

And to think, tonight I started out just wanting to come up with a final roadmap for Photobox v2.2.0!

Switch Styles

About Style Switching.

!Weblog Index

Aug September 2007 Oct
SU MO TU WE TH FR SA
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Categories

RSS FeedRSS Feed