en | fr  | Contact  | Print  | Share

FrameBeurk documentation

6. Features

6.1. URI rewriting

(See Miscellaneous for a thought about the word "URI")

To activate URI rewriting, the configuration parameter « UrlRewriting » must be set to true, and the .htaccess file -if Apache is used, should be properly set up (see Miscellaneous too).

The requests usually destined to index.php and ajax.php are therefore redirected towards interpreteur.php which analyses the URL and fill in the PHP array of parameters : $_REQUEST[]. The rules for constructing the rewrited URI are sketches underneath :


  • Block (1) is usually present only if the request is proceeded by Ajax. It defines in which div the vue should be displayed at its return from the server.
  • Block (2) is usually provided. If it is missing along with block (3), the default Vue from the configuration is displayed.
    The 4th term of the block is a « slug » : label made of words in lower-case letters and separated by dashes, usefull for SEO (Search Engine Optimization). This slug is not interpreted by FrameBeurk and therefore it is optional. The other terms of the block are defining the unique key for accessing the page.
    With the actual management of rewrited URIs, the slug is not present in the hypertext links generated by FrameBeurk, but present in the canonical URIs of pages and Vues.
  • Optional block (3) requests a Vue with a key token. Blocks (2) and (3) are mutually exclusives.
  • Block (4) specifies the vue to display in case of error during the processing of the Maj action requested by block (5) or (6).
  • Optional Block (5) requests a Maj action giving a full key.
  • Optional Block (6) requests a Maj action with a key token. Blocks (5) and (6) are mutually exclusives.

6.2. Ajax browsing

In the case of an Ajax browsing, the history of pages stays available by Back / Forward buttons, still with transparent Ajax browsing. In order to do so, the client gets the canonical URL from the server response and stores it into javascript object « history ».

Therefore, the technical blocks (Maj action, DivVue...) of the full URI are never shown is the address bar of the browser, as long as the website uses Ajax -whether URI rewriting if activated or not.

6.3. Tag enhancement

Ajax browsing uses a more general feature of the framework that is intented to associate a behavior to an element displayed on the page, without having Javascript code included in the HTML code : This is the tag enhancement.
It uses the ability of HTML to define additional attributes. The principle of functioning is the following :

  • The configuration array associates attribute names to Javascript functions.
  • From this configuration array, FrameBeurk generates the Javascript function that will, at each loading of a page or div, associate the Javascript functions to the OnClick events of all the elements carrying the attribute.

For example, to manage the Ajax browsing, the configuration is :

$CONFIG['Tissage']['Beurk']['Attribut']['data-ajax'] = 'beurk_lienAmeliore';

For a link to a Vue which will display a form before a Maj action, the code of a page would be :

<a href="/forum2/modifie-Commentaire-148" data-ajax="modifieCommentaire148" >Edit...</a>

When the user clicks on a link having the attribute data-ajax, function « beurk_lienAmeliore » reads the content of the attribute to determine which div will display the result of the Ajax request. Hence, the function rebuilds the URI from the content of attributes data-ajax and href.

6.4. DB communication layer

To give to this framework an interface independant from the used SQL database, a communication layer brings « front-end » functions to the standard one of interface mysql (or mysqli), with mainly 2 improvements :

  • The accounting of time spent in SQL requests during the transaction.
  • The possibility to write database requests in associative arrays with a syntax that stays close to SQL.
    • The 1st dividing leads to write SELECT, FROM, WHERE... clauses in separate items of the array.
    • The 2nd dividing allows to have the columns of a SELECT, SET or VALUES clause in an embedded array. Example :
array( 'SELECT' => array('S.IdSection', 'S.Section', 'S.NbrSujets', 'S.NbrSujetsArchives',                      'S.IdCreateur', 'U.User', 'S.TsCRE', 'S.TsMAJ', 'S.Etat'),    'FROM' => 'Rhum_Section AS S '              . 'LEFT JOIN Uzers_User AS U ON S.IdCreateur = U.IdUser '    'WHERE' => "S.IdSection = '$IdSection'");

Using array-requests is not mandatory, except in the case of calling Permissions (this feature is described in the next chapter).


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