en | fr  | Contact  | Print  | Share

FrameBeurk documentation

2. Basics

Like every PHP frameworks, FrameBeurk is made of a set of scripts that are hosted on a distant server machine (*), on which a http program server (example : Apache) is operationnel and running a PHP interpreter module.

When the Internet browser of the user sends a request to the http server, this one runs the appropriate PHP scripts, which generate a page of HTML code (or CSS, Javascript, RSS…) that is sent back to the browser. The browser interprets this code to show a new page or to modify the page already on screen.

(*) : or possibly installed on the computer of the user or programmer, like in the case of the using of LAMP/WAMP (Linux-Apache-MySQL-PHP, Windows-Apache...)

2.1. Browsing

2.1.1. Transaction

Most actions of the user in his Internet browser trigger the sending of a http request to the server. Let's call « transaction » what happens between such an action and the taking into account of the response by the browser, and especially the process taking place on the server between the arrival of the request and the sending of the answer.

The server-side data of the transaction are stored in the associative array $TRANSAC[].

2.1.2. Dialog

The exchange of data between the user Internet browser and the server works through a « pseudo-conversational » mode. This means that from the point of view of the user, there is no discontinuity between 2 transactions. On the contrary, on the server side, the execution of the scripts is interrupted at the sending of the response and the scripts are removed from the memory. The discontinuity is complete.

To keep the consistency of the dialog -i.e. the succession of transactions, the values of variables that have to be re-established at the start of the next transaction are stored in a session : PHP saves them outside of the http server (for a limited and parameterized duration, 30 minutes for example).

The dialogs of several users browsing the same site at the same time are completely separate.

The server-side data of the dialog are stored in the associative array $DIALOG[].

2.1.3. Configuration

Framebeurk is modular, parameterizable and expandable. The features and renderings specific to the site, shared by all users, are set up by parameters that form the configuration of the site. In order to improve the performance of the framework, the configuration is calculated at the start of the first transaction of the user, and then saved in a PHP session.

The server-side data of the site's configuration are stored in the associative array $CONFIG[].

2.2. Actions

Regarding FrameBeurk as an applicative framework, the actions sent to the server -actions that are usually triggered by the user (for example when this one clicks on a link or a button), are of two kinds :

  • The update actions -further named « Maj » for Mise à jour, that will lead to a modification of the information handled by the server -usually the business objects, that are more often saved in a data-base.
  • The view actions -further named « Vue », that will provide information, without modifying the values saved on the server.

In FrameBeurk, a transaction will be made of at most 1 Maj action and 1 Vue action. If a Maj action is requested, it will always be processed first, because it can have effects on the data returned by the Vue action.

Each type of action is declared in the array $CONFIG[] and is defined in a separate .php file.

It is the user Internet browser that sends to the server the information about the Maj and/or the Vue actions to perform, in the parameters of the http request.

The request can also specify an error Vue to return instead of the normal Vue, in case of an error during the Maj action.

2.3. Entities

As I put forward at the beginning of this document, this framework proposes to developpers an approach of the business needs different from the Object-Oriented Analysis, and a sequential or procedural implementation simpler than OOP (see chapter 9). To stay clearly away from the object paradigm, the object-equivalents are called Entities.

Let's try this definition : An Entity is the projection of a business object on the applicative interface. It can be basic or complex, but unlike in OOP, it will never be declared in a core way. The entity will define the actions of Maj and/or Vue type that are available for users.

Each Entity is declared in the array $CONFIG['Entites'][] and is defined in a folder named after it. That folder (and its subfolders) contains all the script files attached to the entities, including actions.

2.4. Modules

The Entities are gathered in functionnaly consistent sets that are named Modules.

Each used module is declared in the array $CONFIG['Controles']['Modules'][] and is defined in a folder named after it. That folder contains its entities and all the ressources that are needed for its integration in the website :
  • Configuration files,
  • SQL scripts for generation of the data-base objects,
  • CSS files, Javascripts, PHP…

2.4.1. Dependencies

Modules can naturally be dependent on each other. One simple example is the calling in a script of module B of a PHP function defined in module A.

If module A declares « function A_fonct() {…} » and module B implements a call to this function « $maVar = A_fonct() ; », module B is dependent on module A and will not be able to work without it.

The documentation of module B shall explicitly hightlight this static dependency.

2.4.2. Weaving

The PHP language allows to store the name of a function in a variable. In FrameBeurk, we use this possibility to make a module call a function defined in another module, without being definitively tied to this module.

Example : The module B uses an alias (i.e. a variable) to call an external function implemented in module A. The website's configuration (*) associates the alias used in module B to the function declared in module A. This weaving between modules is called « Tissage ».

The documentation of module B shall explicitly hightlight the aliases to define for dynamics dependencies.

Aliases are declared in the associative array $CONFIG['Tissage'][]. Example of declaration :
$CONFIG['Tissage']['ModuleB']['alias'] = 'ModuleA_fonction';

(*) : The weaving can be directly set up in module A if this one is statically dependent of module B.

2.5. Page layout

Making an attempt to describe it simply, the HTML page shown by the browser is a set of boxes named « div », included or laid side by side, which contain the business information. The arrangement of divs within each others (and their rendering) is set-up by the style sheet (.css file) declared in the header section of the HTML page which is sent by the server to the browser.

The page layout is usually very steady from a page to another of the same website. Therefore it is very interesting to help the management and the processings associated with the layout. This framework proposes to handle it in the configuration of the website with the following items :

2.5.1. Template

The template (named « Patron » in FrameBeurk) defines the main parts of the page where contents will be dynamically inserted by a controller (see this concept further below).

Each template is a .php file stored in a folder named after it, which also contains other files : header, trailer, CSS files, Javascripts...

2.5.2. Divs

The content of each Div is defined in configuration. Typically, it is a label, a variable or a PHP file to include. When processing a part of the template, the controller includes into it the content of the Divs whose names begin like the processed part. For example : If the template has a div named 'Part1' in which the controller is called, and that the Divs named 'Part1a' and 'Part1b' are described in configuration, they will be declared in 'Part1' and their contents will be inserted there.

2.5.3. Layout

A Layout is the association of a template with declarations of Divs.

Layouts are defined in the associative array $CONFIG['Controles']['Layouts'][]

2.6. Dialog kinematics

In order to assure the best performance to the website, the exchanges with the server are reduced to the minimum in terms of numbers and volumes :

  • All the Javascript files (coming from modules, patrons…) are gathered before sending and stored by the browser in its cache (*),
  • Same process for the CSS style sheets (*),
  • Full reload of the page happens the fewest times as possible. In most cases (up to the programmer), only the modified Vue is refreshed.

For this last feature, specific Javascript functions of the framework implements the Ajax technique (Asynchronous Javascript and XML) following an unobstrusive mode (i.e. links keep on working without Javascript, reload the full page).

(*) : The reloading of CSS and JS files by the browser will be forced by the changing of the version number of the website on the server.

2.7. Events

(This feature is still in planning stage. Nothing has yet been developed.)

When a vue is reloaded alone without the whole page, it may happen that the content of un-refreshed vues is no more up-to-date (for example if a Maj action has been processed). To ask the refreshing of these Vues after the server answer, an event management is established between the server and the Internet browser of the user.


© 2010-2015 by ToolOscope SASU. © 2016-2018 by Arnaud De Rette. All rights reserved