from php to zope to plone


How to move beyond php - using zope, and later plone. A tutorial.


I have developed in PHP for several years, and enjoyed it greatly at its time. But the further I got, the messier things got. I basically found myself rebuilding things all the time, and plugging different applications together was not much of a possibility. Then I encountered zope, and I fell in love with it. Hundreds of people using the same application framework (not the same language only), with most of the products working together in a relatively easy way. And its so fun to use. And its so fast to use. And it allows you to write your data using ftp. And, and and.…

Basic concepts in PHP

In the end coding in php is using a couple of basic concepts. We use a browser to  call a .php page. It contains some code, some variables. It is very likely to pull data out of a database. It processes some input from the page before, or some form data. It then spits out some html, maybe using some template engine, voila!


Most likely we are serving the php pages from an apache webserver. php might get called as a cgi or is a built in module. Our web browser connects to apache, that it turn calls php, and that does the magic


php basically delivers you a language to be used within pages, or maybe the other way around, it provides you a scripting language in which you can embed html. I don't care which way, the opinions on this differ, but it does not make to much a difference. When the php page is called, php builds a couple of variables, and then start to go through our code.


There are more or less three different kind of variables - server side variables, browser variables and user input. The distinction is a bit arbitary, but works. Server side variables is what you usually find in _SERVER, but also PHP_SELF etc. All the stuff about the server, the script itself. Browser variables is data send by the browser - which page to parse, which encodings it accepts, cookies. And then there is direct user input data, data from forms or GET data, appended by '?'.
php mixes cookie and user data together to some extend, even though you can access them seperately.


Most of the data is stored in a database, mysql or sqlite (these days). You want to store a car instance? You create a car table with a couple of colums: id, number plate, number of wheels, brand, color etc. All the cars have the same structure, but different data within the structure. You explicitly store and receive the data. You can do funky joins. If you are lucky, you are using transactions.


I tend to develop my php applications on my laptop, and then I transfer my scripts using ftp (or ssh) to the server, putting all the scripts and images etc. somewhere in the filesystem of the server, The data lives in the database, and is managed using phpmyadmin or sometimes directly through the console.

Whats missing?

Three of the most anoying things I found over time are lack of transactions, lack of application framework  and lack of namespaces.

Lack of transactions means that if you script breaks, all the changes you have done to data so far are written, things that were planned to come later in the script did not happen. Think of writing some data into a file, and then deleting the written data from the database. Now, if I make a programming error between the two steps I have data in the file, and data in the database. I have a dirty programming style, basically writing a couple of lines, then testing the lines and cleaning till they work. So whenever my script breaks, I have to check if my data is still somewhat working.

Lack of application framework: all that php provides is a language. It does not provide a concept of users, or a security mechanism at all. So every application has to reinvent the wheel, basically making sure that no two applications will work smoothly together. You can't assign a couple of roles here, and it will work over there in the other application.

How do they translate to zope

Where do we find our beloved xyz? How do I foo in zope?


Form data


Fast prototyping in zope


Proper development

Generic Setup