Zones : The Zoop Controller

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:

  • Many separate php files residing in a program directory or subdirectory.
  • If you want to run the function in that file you go to http://example.com/program/file.php
  • This 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.

    This is the online home of

    This is the online home of From A to Zoop: a beginners guide to Zoop.70-448 This is an online book in that 650-299 it is intended to be read in order. as each chapter builds on the chapters before it. It is also a handy reference when you want to know how to do something. 642-627 This book will be kept current with the current stable version of Zoop. It is authored by the creators and maintainers of Zoop and can be considered the greatest book of it's kind

    roter 07 Sep 2011

    Good to see it here

    PHP contents are widely being searched by the developer community so new techniques and tools much be shared over here. I love to visit it, as its being updated with the passage of time. Keep sharing more in more impressive way. Waiting for some programming techniques.top websites for technology

    iamasterss 19 Dec 2011

    I assume it is highly

    I assume it is highly important for a device like this to be able to sort data by history, length or any other criteria users may actually think of and be anxious to apply. Text marketing services, for instance, are some of those providers who offer services of ranged data and activity accordingly to the client`s requirements. I think they should work a bit more on the page functions of php.

    gregory 12 Jan 2012

    reply

    It’s really a nice and useful piece of information. I am satisfied that you just shared this useful info with us. Please stay us informed like this. Thanks for sharing
    donna cerca uomo parma and
    donna cerca uomo padova and
    donna cerca uomo perugia and
    donna cerca uomo messina

    jacklavoro 23 Jan 2012