Article

eZ publish: PHP's Killer App - Parts 1-3

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Next

Yet another CMS?

"OK", I hear you say, "another content management system. Big deal."

What makes eZ publish special is not the impressive list of features, but what's going on behind the scenes. eZ publish is in fact an application development framework, providing PHP developers with a structure in which to build applications and, from there, rapidly deploy them into a live environment, saving you many hours of coding.

If you've ever written you own PHP Website from scratch, you've probably found yourself wishing there was an easier way to do things. You¡¦re confronted with a multitude of issues: where to place the scripts for your site, how to build an integrated site navigation system, how to prevent reproducing the same blocks of code for every page of your site¡K and a whole host of other problems (meanwhile, your social life packs up and heads to Hawaii).The long-awaited completion of a site can often feel like a miracle... then someone comes up with a great idea for some new features and you're re-writing the entire site again, weeping quietly to yourself.

An application development framework eradicates the burdens of building Websites. By conforming to its rules and guidelines, you'll find the maintenance and expansion of your site a breeze. A good framework should make 90% of the design and development decisions for you. Solutions to issues such as naming conventions, where to place your scripts within your Website file system, how to design and structure your code, and all those other fine details you struggle with, are simply a matter of following a set of clear guidelines. And what about all that code you used to waste hours on, such as database connection and query functions, the work you reproduced over and over again for every new site? All that should be available within the framework for you to re-use as needed.

This is what eZ publish really offers: the chance to make your life as a developer a carefree and pleasant one.

PHP Coder General's Warning:

Developing with eZ publish means writing Object Oriented code!

Much as we all love to write "hacked" scripts using procedural code (perhaps with a few PHP functions included only when we really have to), the truth is, if you want to have any hair left a year or two from now, you need object orientation. Writing object oriented code in PHP is not just about saving time: it allows you to solve coding problems that simply cannot be solved by procedural code. Once you've got two or three PHP classes working together in an application, you'll realise you never want to go back. And then you'll be able to hack away like you've never hacked before!

Put another way, object orientation give us the means to write re-usable code and integrate different applications and functionality into a single whole. For example, you may already have run into difficulties on one of your sites, where you implemented a user authentication system and signed loads of people up. You're now scratching your head as to how to integrate it with a forum application like VBulletin or phpBB without forcing your users to sign up again. If we all wrote more object oriented code, at least half these problems would be solved.

In general, the way eZ publish functions in tying together its various modules, is conceptually similar to the Fusebox approach. This strategy for building Web applications was conceived by developers working with Coldfusion, and has now made its way to PHP at Bombusbee.com. The basic concept behind a fusebox-like site is to have a single script (usually index.php in the Web root) that acts as "traffic cop" for the site, all pages being served "through" index.php. For further details on the Fusebox approach, try the Fusebox Newbie Guide. From an application design perspective, eZ publish loosely conforms to the Fusebox approach, so it may help to read about Fuseboxes in preparation for the third article in this series. But don't panic! We'll leave further discussion of object orientation and application design until the third article in this series.

Back to eZ publish! To whet the appetite of those who know your way around PHP classes, have a look at the eZ publish Class Index. Then wander over to the eZ publish sdk currently in development for eZ publish v.3.

Hopefully by now you're at least sold on the idea that eZ publish is worth your effort. In that case, it's time to roll up our sleeves and get installing! eZ publish, here we come.

Installing eZ publish

In setting up a working version of eZ publish, I'll dare to assume you use Windows and are willing to set up a demo on your own machine. The installation process used here can very easily be applied to a LAMP (Linux, Apache, MySQL, PHP) virtual host environment common to many Web hosts.

It's recommended you have at least PHP version 4.0.6 installed (even better if it's PHP 4.1+) under Apache 1.3x as well as MySQL 3.23 or later. If you don't have those installed, look no further than Firepage's phpdev, an install set that gives you Apache, PHP and MySQL in one tidy package (plus a few other nice things like PHP-GTK and phpMyAdmin). The current phpdev5 beta3 is very stable but to save yourself some headaches, it's recommended you use Apache 1.3.x rather than 2.x (phpdev5 beta 3 comes with both).

The version of eZ publish used in this article series is 2.2.6. The install process may vary for different versions, and be aware that eZ publish is very sensitive to the correct php.ini settings. If you have any problems with the instructions used in this article, please drop your questions in the SitePoint Forums discussion at the end of this article. Otherwise, you'll find plenty of people willing to help at http://developer.ez.no/developer/forums/.

Down to Business

eZ publish 2.2.6 can be found from the filemanager at http://developer.ez.no/filemanager/list/85/. Download and unzip to somewhere under your local Apache or PHP Web server -- with phpdev5, this will probably be something like "C:\phpdev5\www\public\".

Note: an eZ publish Windows installer exists -- it also installs Apache, PHP and MySQL. However, we'll do things little differently, so that we can re-use the install process on our live LAMP virtual server.

Having unzipped eZ publish, you'll now have a directory that looks something like C:\phpdev5\www\public\ezpublish_2_2_6\ (I'll call this directory your "eZ publish Root" from now on). Under there you'll find an installation directory, which contains a file called INSTALL.pdf -- Chapter 3 of this document is the method we'll be using to install eZ publish.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links