Manual:HTMLForm Tutorial/fr

est un assistant puissant et facile pour construire des formulaires dans MediaWiki. Ce tutoriel va permettre aux développeurs de rentrer dans le sujet avec HTMLForm.

(HTMLForm being a front-end helper, it's assumed that you are developing a front-end extension. ie: a special page)

The rest of this page is about the basics of creating a generic special page extension called MyForm. Ceci n'est pas directement en rapport avec ce tutoriel, mais il n'est pas inutile de montrer comment l'extension se présente. En bas de la page, le Special:MyForm affiche « Hello World ».

Si vous êtes d'accord, commençons...

Fichiers et environnement

 *  This explanation applies to MediaWiki version 1.23 and later. 

HTMLForm classes are located at. The code is pretty clean and well-documented enough, that should make MW Hackers happy.

Your SpecialPage is in an extension called MyForm. You'll find it by accessing Special:MyForm.

Your SpecialPage's front-end code can be at: This previous file enclosing both View/Controller, the Model (main file of your extension) can be at: The files can be found in the folder: Then .hooks, .alias... etc.

LocalSettings.php
Do not forget to install your extension by adding:. When using extension registration, use  instead.

MyForm.i18n.php
This file will hold all the messages used within your form. Be careful with the messages' IDs, they will be specified later in this tutorial.

MyForm_body.php
Finally, the file that interests us the most.