Zoop does not require, but largely benefits from using it's own programming structure of zones.
What are zones?
To understand zones we will describe what a program would look like without zones. A plain php program would consist of the following:
http://example.com/program/file.phpThis approach has a number of disadvantages.
- It is very unorganized and messy.
- There is no distinction between library files and files that generate content.
- You need a new php file for each page you have in your application.
- There is no MVC (separation of content, design and core functionality).
This plain php approach works perfect if all you are doing is writing a script to handle the post from a form, but it falls short when using php to develop an application.
Note: There are multiple approaches to solving this issue with php and zones is a very elegant one, but certainly not the only one.
A zone is a group of pages with a similar function or subject. For example most applications have a set of pages for administration. In our traditional PHP example, they would be a number of php files organized in a single /admin directory. In a Zoop application, the logic ( in the MVC model for applications, the controller portion) for the page is contained within a method called pageXXXX in the zone_admin class, which is generally defined in a file called zone_admin.php.
So inside the single zone_admin.php file is an object (class in this case) called zone_admin. Inside of that object exist many functions, one for each separate page. These functions are called page functions.
Going to a page in Zoop
Because of the zone architecture, going to a page in Zoop is a bit different than standard php. In our standard php example, say there is a page to edit a user. This page is in the admin section, eg. application_directory/admin/edituser.php. To go to this page in a web browser you would go to the url http://example.com/application_directory/admin/edituser.php
In Zoop things would be done a bit differently. First the same function would be located in a different place. In the file zone_admin.php, in a function called pageEditUser inside of the zone_admin class. To view this page in a web browser you would go to http://example.com/application_directory/index.php/admin/editUser
It is very similar to a standard php approach, but has subtle differences. Notice the additional index.php there. There are many advantages to using zones beyond organization, and zones provide a lot of functionality that could not be practically accomplished any other way. Later we will revisit zones and provide more in depth information on some of these benefits.