View strategies

Strategies are means to simplify and reduce the code used in the view layer.

Working with the view layer

The view layer has exclusively code related to presenting data into a view.

Following the MVC pattern it has access to the model, but this access should not include any actions to change it but just calls to retrieve data.

In order to simplify and reuse presentation code a strategy pattern has been applied, so the class just need to retrieve the concerning data and pass to the specific view_strategy object.

The view layer of Tequila, consists of:

    1. Application_view child class. Provides the methods / modes available for viewing.

    2. View_strategies (common). A set of classes created to reuse the code to render a view.

    3. Template file. An html class with Html comments that defines the design of the view

    4. Language file. A php file that sets the text for an specific language.

Understanding strategies

Strategies are a pattern for code reuse. Tequila implements strategies on validation a presentation layer.

The main idea is to avoid repetitive code and allow complex screens/controls to be done without too much work.

Some basic strategies are provided:

    • View VO

    • View Array

    • View Loop block

    • View Select

    • View editor

    • View object

    • View pagination

    • View Tree

    • View LDAP Tree

    • View XML Data In the future more strategies will be developed

    • View calendarized (in progress)

Using strategies