Archive for the ‘PHP’ Category

PHP as a template language

Thursday, February 11th, 2010

It's been a while since I blogged, but I just ran into another zealot pointing me to NoSmarty.net when I mentioned templating.

I think I've said it before. The tool you use should depend on the job you're trying to do. So to say that Smarty is wrong just because it is, does not feel right.

I agree that in many cases PHP can be used as a template language just fine, but there are situations where a Smarty template (or any other templating engine) is just that more pleasant.

Here's a bit of template code that I encountered yesterday. Its use of php as a template language is hideous. Because it's a template for an xml message and because it needs to cope with systems with short open tags on and off, it looks like this:

 
<?php echo '<'; ?>?xml version="1.0" encoding="UTF-8"?>
<result processed="<?php echo $data["processed"]?"yes":"no"; ?>"
       <?php if (isset($data["orderid"])) { ?>orderId="<?php echo $data["orderid"]; ?>"<?php } ?> >
       <?php if (isset($data["error"])) { ?><error message="<?php echo $data["error"]; ?>" /><?php } ?>
</result>
 

Hideous!

Here's what it would look like in Smarty:

 
<?xml version="1.0" encoding="UTF-8"?>
<result processed="{if $data.processed}yes{else}no{/if}"
       {if $data.orderid} orderId="{$data.orderid}"{/if}>
       {if $data.error} <error message="{$data.error}" />{/if}
</result>
 

Yes, the first one is slightly more efficient, but the second one is actually readable for the average person.

Anybody claiming that <?php } ?> is 'just as convenient' as {/if} does not think clearly.

In my humble opinion, of course.

ZendCon 09 - Update and Slides

Thursday, October 22nd, 2009

In my previous post I collected rumours about the opening keynote. Turns out none of them were right. The announcements were a beta of Zend Studio 7.1 and the beta release of Zend Server 5.0. The latter does get a step further in the enterprise direction with the addition of a Job Queue feature. I personally wasn't too impressed, Job Queues were already available in Zend Platform a year ago, and has since been overtaken by Gearman adoption. The new 'code trace' feature, which adds a kind of 'flight recorder' to PHP apps, looks very promising. Where past versions were already able to pinpoint where the problems were, this version will also give you a complete trace of every function call and parameter up to the problem. According to Andi Gutmans it performs fast enough to do that even on a production environment. I'm definitely going to check that out.

Today I had my own talk, "PHP and the Cloud". I had a godo 45 people in my session, which means that I owe the PHPBenelux usergroup a beer, since they showed up with 63 people for my Try-out last week. :-)

The slides for my session are on slideshare, or you can browse them directly here:

ZendCon 09 - The Rumours

Tuesday, October 20th, 2009

In about 15 minutes, Andi Gutmans is about to kick off ZendCon 09 with his opening keynote. Yesterday during the tutorial day and this morning over breakfast, I've been polling people to see what big announcements they expect this year. "Microsoft buys Zend" and other fun but improbable announcements aside, here's a selection of what people think might be announced today:

  • Zend Certification for PHP 5.3
  • Zend Framework 2.0
  • a Google AppEngine for PHP
  • Zend Studio Certification
  • Zend Server for OSX
  • Zend Server Enterprise Edition

If you follow me on Twitter, I'll probably mention any specific announcements there realtime.

Long time no blog

Wednesday, August 19th, 2009

Somebody just kindly reminded me that it's been over 3 months since I last posted on my blog. Oh my.

What kept me busy mostly the past months is my new home. I moved to Utrecht (which is more in the center of The Netherlands, so I can get around more easily) with Leoni, and as developers say, the house is "90% done". So it'll keep us busy for a few months. :)

Things at Ibuildings are hectic as always. Our UK office is growing like crazy and is nearly half the size of our NL operation already. And we're working hard to get our Italian office up and running. Behind the scenes we're already working on things there, so if you're looking for a cool PHP job in Italy, drop me an email (ivo at ibuildings dot com). (Actually Ibuildings NL and UK are looking for senior developers too, if you're interested). After a succesful DPC back in June, we're planning a few more events so keep an eye on the Ibuildings website for news on those.

Another thing that has kept me busy is one of my personal pet projects, Flackr, a twitter based breaking news aggregation site. It has fairly basic functionality at this point (we've been mainly working on the news aggregation and event detection algorithms), but will eventually grow into a 'newsroom 2.0' type application with pro features for journalists. Here's an example of how it tracks tweets related to the Hurricane Bill including pictures. Contrary to many twitter aggregators, it doesn't follow the masses, but trusted sources only.

Finally, I'm happy to announce that I've started work on a new book. Enterprise PHP sold very well and it's not outdated yet, but writing it was addictive and now I just feel like writing another one. The book will be about PHP and Cloud Computing. This time around I'm not working on it alone, I'm co-authoring it with Vito Chin, author of the GMagick PHP extension, among many other things. The expected publication date is early 2010.

That's it for now; I hope to pick up blogging with more actual content after summer.