Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > Explicit join declarations

Explicit join declarations

The links between tables are declared within SPIP in the ecrire/public/interfaces.php file. Further declarations can be added with the "declarer_tables_interfaces" pipeline.

Such a declaration might look like:

  1. // suggest a join between sections and documents
  2. $tables_jointures['spip_rubriques'][]= 'documents_liens';
  3. // suggest a join between articles and authors, specifying the join field explicitly
  4. $tables_jointures['spip_articles']['id_auteur']= 'auteurs_articles';

Download

This shows the links that are possible between tables, When 2 tables can have several fields to link between them, the example above shows how to specify the linking field precisely.

Exceptions

It is even possible to create joins by calling non-existent fields, as demonstrated by the sample criterion {titre_mot=yy}, which can lead to a join on the "spip_mots" table, even though the "titre_mot" SQL field does not exist in that table. This is done as shown below:

  1. $exceptions_des_jointures['titre_mot'] = array('spip_mots', 'titre');
  • Author :
  • Published :
  • Updated : 28/06/10
  • Translations : English, français