Coding with SPIP 3.0
SPIP3.0 Technical Documentation

> > > Adding a type of glossary

Adding a type of glossary

It is possible to add links to external glossaries from SPIP using the [?nom] shortcut. By default, the links are made to wikipedia. To create a new glossary link, there is the [?nom#typeNN] syntax available.

  • type is a word for the glossary
  • NN is an optional numeric identifier.

A simple function called glossaire_type() is used to return a particular URL. 2 parameters are passed: the text and the identifier.

Example:

A link to the trac source files for SPIP 2.1:

  1. <?php
  2.  
  3. @define('_URL_BROWSER_TRAC', 'http://trac.rezo.net/trac/spip/browser/branches/spip-2.1/');
  4.  
  5. /*
  6.  * A link pointing to trac files
  7.  * [?ecrire/inc_version.php#trac]
  8.  * [?ecrire/inc_version.php#tracNNN] // NNN = line number
  9.  */
  10. function glossaire_trac($texte, $id=0) {
  11. return _URL_BROWSER_TRAC . $texte . ($id ? '#L'.$id : '');
  12. }
  13. ?>

Download

  • Author :
  • Published :
  • Updated : 02/06/10
  • Translations : English, français