Installing Apache 2 and PHP 5 on OS X

Kellan found that it was easy to build Apache 2.0 and PHP 5 on Mac OS X.

XPath evaluation in PHP with Namespaces

If you’re working with XPath in the DOMXML extensions to PHP, there’s an undocumented function you’ll probably need: xpath_register_ns (xpath context, namespace prefix, namespace uri).
Without it, you’ll have to write ugly XPath expressions for documents with a default namespace (such as those returned by FileMakerPro.)
Thanks to Brandon Whitehead for pointing it out in the annotated [...]

PHP5’s Simple XML Module

[ via Bitflux ] An introduction to PHP 5’s SimpleXML module.

Really, Catalogs Matter

This week I learned that XML Catalogs are very important.
This started when I updated Marc Lyanage’s PHP binary for Mac OS X on my development machine.
Pages went from taking miliseconds to over a minute to render. To say I was puzzled would be an understatement. I rolled back to an earlier version.
Looking for Clues
Some initial [...]

PHP Syntax Checking in BBEdit

Use AppleScript to check your PHP syntax from within BBEdit. Bloody brilliant!

XML in PHP5

Christian Stocker’s slides on XML/XSLT/XPath support in PHP5. Some highlights:

LibXML2/LibXSLT become the ’standard’
Implements W3C Level 2 DOM
XSD and RelaxNG validation

I’m looking forward to it.

PHP from XSLT

Christian Stocker’s checked in some code to PHP5 that’ll let you call any PHP function from within your XSLT. Not really portable, but there’s something nice about being able to generate ISO dates without passing them in as parameters to the transform.
Here’s Christian’s example:
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”

xmlns:php=”http://php.net/xsl” version=’1.0′>

<xsl:template match=”/”>

<xsl:value-of select=”php:function(’date’, ‘r’)”/>

</xsl:template>

</xsl:stylesheet>

Using XPath to mine XHTML

Simon discovers XPath. He likes it.
If you’re on a Mac, go directly to Marc’s site and download his build of PHP with LIBXML2 and LIBXSLT built-in so you can play with XPath.

PHP and Unicode

For future reference: writing Unicode applications with PHP.

Daily Japanese Lesson

Random Chaos has a daily lesson in Japanese. Oh, and it’s using PHP, so if you think you need .Net or Java to write an international web application, you’re BAKA.

Beyond The Template Engine

[ via Eric Snowden ] Brian Lozier has a great Sitepoint article on PHP template engines.
His main point is that a template engine should dissociate presentation from logic, not keep PHP code out of HTML.
He gives us a compact, caching template class using those principles. His templates use PHP’s echo () and the alternate for-each [...]

PHPMailer

PHPMailer came in handy at work this week. It’s a nice class that provides plenty of features over and beyond PHP’s mail () function. You can send MIME attachments; select between Sendmail, Posfix, and qmail; and send HTML email (but you won’t do that, because it’s rude.)

Cocoon’s Competitors

From the Cocoon Wiki, a list of open source and proprietary projects similar to Apache Cocoon.
From that list, mod_murka looks neat. It looks for a cached HTML version of the request URI, and if it’s not found, looks for the .xml file, transforms it using whatever stylesheet’s mentioned in the file’s processing instruction, and caches [...]

XMLNuke Content Management System

XMLNuke is an XML/XSLT content management tool. The authors have written versions for PHP as well as C#.

Emulating AxKit/Cocoon 1.0 in PHP with DOMXML

I mentioned Kevin Davis’ experiments with Movable Type and XSLT earlier. He had asked about how to integrate his XMLized weblog with PHP’s DOMXML extension so he could transform it on the server side instead of depending on IE or Mozilla to do it on the client.
Using DOMXML to transform XML in PHP is straightforward, [...]