Intro ┬╗ Core Design Patterns of ATK

Agile Toolkit introduces several core principles.

Five types of objects

Agile Toolkit loosely follows MVP (Model View Presenter) principle and defines the key 5 types of objects that will make up your application:

When you have downloaded Agile Toolkit and went through the set-up wizard, it will help you create a Application class and your first Page class.

  • frontend/lib/Frontend.php - contains logic of your application.
  • frontend/page/index.php - contains logic of your landing page.

At this point you can fire your favourite text editor and add more UI objects into your page. The following logic will apply on all the UI objects in Agile Toolkit:

add() method

This method allows you to add new UI elements into existing ones. There are no limitations on what you can add where and how, as long as you are using common logic. Here is example:

  • add Form on the Page
  • add Button on the Form

In order to write this code you need to open your page class and inside the init() method write:

$form = $this->add('Form');
$button = $form->addButton('Click Me');

init() method

When you add new classes (and we already have Application and Page class defined) ou should use init() method to add "contents" of that class. Create file lib/MyButton.php containing:

class MyButton extends Button {
    function init(){
        $this->set('Click Me');

Now you can use the following code anywhere:


Keep adding and initializing

Those two are the most fundamental principles of Agile Toolkit. As long as you keep adding more widgets on your pages and create your own widgets you can implement web application of any complexity.

Page inherits "View" class itself, so it has the same properties as any view object. There are other types like "Layouts" and "Virtual Pages" but you can learn them one class at a time.

Continue to next page..