Simon Willison’s Weblog

Subscribe
Atom feed for php

190 posts tagged “php”

2003

Smarty Links

I’m using Smarty in a project at Uni at the moment, mainly as a tool to allow team members to modify different parts of the codebase without stepping on each other’s toes. I’ve seen some good arguments against templating solutions such as Smarty, based around the point that PHP is already a templating engine so the extra layer of abstraction just isn’t necessary. Never-the-less, I’ve been finding that Smarty dramatically improves my productivity even when I’m working on my own. Here are the links I’ve provided for my team members to help get them up to scratch on how it can be used:

PHP SOAP Documentation

Finally some good documentation on using SOAP with PHP: PEAR::SOAP Client Fast Start and Extending PEAR::SOAP WSDL, both from the excellent phpPatterns.

PHP5 and Questioning OOP

An Interview with Sterling Hughes on PHP5 from the PHP-Con site:

[... 353 words]

Verbose Regular Expressions

Ned Batchelder describes Verbose Python regular expressions. This is one of the things I’ve known about (as in known that they exist) for ages but have never got around to using. I’ve been working with some pretty heavy regular expressions recently that could really do with the clarity of being defined in verbose format with comments.

[... 96 words]

HTMLCleaner class for PHP

htmlcleaner is a PHP class which claims to be able to clean up the revolting HTML generated by Micrsoft’s HTML libraries, in particular the one that is used for browser embedded WYSIWYG editors. We’re using HTML Tidy for this with excellent results, but for people who can’t run HTML Tody this could be a useful solution. Unfortunately the class is hosted on PHP Classes which still insists on making you log in for no apparent reason.

HttpClient PHP class

I’ve been working in quite a roundabout fashion recently. My principle target is to build a collaborative blogging system. As part of this, I needed an RSS aggregator to allow a single blog to show the most recent entries from a number of other, related blogs. Then I needed a way of downloading RSS feeds from external sites. While thinking about this (although to be fair it’s pretty much a solved problem) I was inspired to build something that could cache whole sites. And that lead me to need a PHP HTTP client class for retriving information from the web. So I wrote one of those :)

[... 381 words]

SmartPHP.net

SmartPHP.net has some useful looking classes, including SmartTemplate (like Smarty but much simpler to use) and SmartCache, a very intelligent caching class that can be used to cache data objects as well as the output from whole pages. The example given caches a database query using the SQL statement as a unique cache key:

[... 108 words]

A PHP Installer

Wez Furlong is working on a generic PHP installation script. If he finds a nice solution to the safe_mode and open_basedir restrictions mentioned in his post this could be a hugely useful tool for the PHP community.

PHP5 info from Sterling Hughes

Sterling Hughes has posted the slides he will be using for his presentation on PHP 5 next week. They provide a great deal of insight in to the new additions to look forward to in PHP 5, including a few I hadn’t heard about before.

[... 209 words]

coWiki uses PHP5

coWiki is the first open source project I have seen being developed with PHP 5, using snapshots from CVS. It looks like a really neat wiki system. Of particular interest for PHP heads is the development log on the front page (sorry, no permalinks) which provides some insight in to the progress of PHP 5’s development.

Some PHP notes

I ran an intermediate to advanced PHP session at University today, on behalf of BCSS. The turn out wasn’t particularly impressive, probably because the only lecture today had been cancelled so there were a lot fewer people from our course on campus than I had expected (the session was arranged because a piece of group coursework we are working on at the moment uses PHP). The notes I put together from the course are available online. They were put together in a bit of a hurry, so please tell me if you spot any mistakes. Topics covered include sessions and cookies, classes and objects, references and some brief notes on writing secure code.

PHP and Javascript spell checker

Last week I commented that Sam Ruby’s spell checking feature could be made even funkier with the addition of a javascript powered “corrections” menu. I spent a few hours this afternoon playing with the idea, and I’ve now got quite a nice proof of concept:

[... 186 words]

PHP5 Preview

A great preview describing the features we have to look forward to in PHP 5. Proper object reference handling is going to be sweet.

Hashing client-side data

Via Scott, a clever PHP technique for ensuring data sent to the browser as a cookie or hidden form variable isn’t tampered with by the user:

[... 248 words]

2002

One time URLs with PHP

Generating One-Time URLs with PHP has some simple example code which demonstrates PHP’s file locking functions in action.

PHP for the enterprise

PHP5: Ready For The Enterprise? (via Scott) discusses forthcoming improvements in PHP5 and asks if they will lead to acceptance of PHP as a suitable language for enterprise applications. It looks like a killer factor could well be PHP’s improved Java and .NET integration abilities. Write the back-end in Java/.NET and use PHP for the front end—that way you get a powerful web-specific scripting language for the front end of your site. Then if you ever need to change technologies on the back end your front end code can be reused.

The evolution of PHP

Via ReadingEd, an interesting article on the Object Oriented Evolution of PHP by Zeev Suraski (the Ze in Zend). As well as a history of PHP’s OO support, the article provides some tasty snippets of information as to improvement to look forward to in PHP 5. Personally I can’t wait for the objects to default to passing by reference, but the exception handling is going to be very nice as well:

[... 209 words]

PHP training update

The aforementioned PHP training system was a mixed success. On the one hand, I discovered that trying to teach a room full of people is a lot tougher than I had expected (to cut a long story short, I stumbled through about five minutes of reiterating the same few points before all present agreed that the session would be best run using the ask-questions-when-you-get-stuck format). Luckily I had prepared some pretty comprehensive support material the night before. I’m chalking that one down to experience.

phpPatterns

phpPatterns is a brand new site which advocates and documents the use of object oriented design patterns with PHP. It’s a great concept and the site already has some impressive content (although it could really do with a PHP references tutorial). The site is a project of Harry Fuecks, a regular contributor to SitePoint’s PHP forums.

Funky caching explained

I didn’t take much notice of “funky caching” while reading through Rasmus Lerdorf’s PHP tips and tricks presentation—I saw that it was talking about using custom 404 pages to serve up dynamic content depending on the URL and wrote it off as a hack that, while useful, was fundamentally flawed in that it would add an error log entry whenever a page was served.

[... 208 words]

PHP tips and tricks from Rasmus

Rasmus Lerdorf has published a PHP Tips and Tricks PDF based on a presentation given at the recent PHPCon2002. The file is a veritable goldmine of useful information, covering topics including optimisation, sessions, security, dynamic image/flash/PDF generation and using Squid and MySQL replication to increase the performance of a high traffic site. Spotted on PHPDeveloper.org.

Partner as a case study

I’ve been helping my partner Natalie Downe recreate her site using CSS and structural markup. She’s new to web design and has been taking to CSS like a duck to water—as a veteran of Microsoft Word globally defined styles come to her naturally and she took very little time to cotton on to the importance of seperating presentation from content. I’ve shown her tables as well but she isn’t really interested as she sees CSS as a much better solution for general presentation. I’m hoping to help run an HTML/XHTML/CSS training course at the University early next year with a heavy emphasis on structural markup, standards compliance and accessibility so it’s great to have a guinea pig to play with :)

[... 203 words]

Zend re-design... terrible!

Zend (the commercial company behind the PHP scripting language) have launched a redesign of Zend.com. My verdict on the new design ... terrible.

[... 161 words]

Software Engineering practises for PHP

Scott Johnson’s presentation on Software Engineering Practices for Large Scale PHP Projects is fantastic—lots of excellent practical advice for professional development with PHP. It’s a shame the presentation slides require Internet Explorer (due to being exported from Power Point) but it was more than worth firing up IE to view them.

PHP at Yahoo

Making the Case for PHP at Yahoo! (via Jeremy Zawodny) looks like it was a great presentation. The slides include the reasons PHP was chosen over ASP, ColdFusion, JSP and Perl and has some interesting details on the history of Yahoo’s server side technologies. Jeremy has extensive coverage of PHPcon so be sure to flick through some of his recent entries while you are there.

Advanced PHP resources

HarryF on the SitePoint forums has compiled a fantastic list of Advanced PHP Resources, with links to sites covering object orientation, general application design, n-tier layering and using PHP with XML.

Voostind interview

Virtual Interview: Vince Oostindie (via techno weenie). Vincent is the author of the excellent Eclipse Library for PHP and a regular on the SitePoint forums, where he frequently educates people in programming PHP using OOP methods. The interview is well worth a read if you are interested in either of these topics.

Sensible URLs with PHP

Brent Simmon’s Law of CMS URLs:

[... 187 words]

Two new web services

I’ve implemented two example web services to demonstrate the Incutio PHP XML-RPC library’s capabilities. The services allow you to search and retrieve articles from FOLDOC and the Jargon File, two popular freely available online dictionaries.

[... 349 words]

New version of IXR

Announcing beta 1.5 of IXR, the Incutio XML-PRC Library for PHP. The library has undergone a complete restructuring and has a much cleaner design as a result. It also has a huge stack of new features, including:

[... 96 words]