Submitted : _TITRER_DOCUMENTS

**SPIP**

# Article submitted

The article "**\_TITRER\_DOCUMENTS**
(https://www.spip.net/ecrire/?exec=article&id_article=6606)" is submitted
for publication. on Sunday 4 October 2020.

* * *

## \_TITRER\_DOCUMENTS

Sunday 4 October 2020 , by [jack](.././?page=auteur&id_auteur=593&)

The constant `_TITRER_DOCUMENTS` will force the titling of documents from
the file name.

## Table of contents

* Functioning
* Activation
* See also

## Functioning[|Back to the table of contents](#s-Functioning)

When a new document is added, this constant will force SPIP to take the
name of the file as the "title" of the document.

The title is based on the file name without its extension. Punctuation
marks (including "_" and "-") are replaced by spaces. Capital letters and
accents are preserved.

**Example : **
When adding the file `My_super-file.pdf`, the name saved in the database
will be "My super file".

Note: by default, the title is left blank.

## Activation[|Back to the table of contents](#s-Activation)

Dans votre fichier `config/mes_options.php` (voir l’article qui lui est
consacré (https://www.spip.net/ecrire/?exec=article&id_article=4654)) :

    // Titrer les documents joints à partir du nom du fichier

    if

    (

    !

    defined
    
     (http://www.php.net/defined)
    
    (

    '_TITRER_DOCUMENTS'

    )

    )

    {

    define
    
     (http://www.php.net/define)
    
    (

    '_TITRER_DOCUMENTS'

    ,

    true

    )

    ;

    }

## See also[|Back to the table of contents](#s-See-also)

* The DOCUMENTS loop
(https://www.spip.net/ecrire/?exec=article&id_article=2381)
* Adding a File Format
(https://www.spip.net/ecrire/?exec=article&id_article=2476)

— Sent by SPIP (https://www.spip.net/)

rubon199-7e493.jpg