clement at seizam
Jul 31, 2012, 1:54 AM
Post #2 of 3
Adm <linuxloverstaff <at> gmail.com> writes:
> I'd like to do thinks in the better way...then:
> I have to made an extension similar to BoilerTemplate.
> Right now I made a special page and I'd like to put in a form to let
> user choose a teplate.
> Some questions:
> 1) Must I use some apis to render the form?
> 2) How to set the form target? Hidden input tags are a good solution
> but: how can I have a clean urls ready form?
> I'm ready to read any tutorial you can suggest me,
> thanks for your attenction,
The HTMLForm Class  is very useful to build forms on MW.
It is directly used by most core forms (Preferences, Upload, Block...).
It will most probably suit your needs, if it doesn't, I advise extending it.
There's a documentation  and a tutorial  on mw.org.
There is also FormSpecialPage  extending SpecialPage with build-in HTMLForm.
I never used that, but perhaps it is the abstraction level you're looking for.
I might not understand question 2) very well:
HTMLForm has it's own way to set the target, using
$htmlForm->setTitle($this->getTitle()); #in the case of a SpecialPage.
Targeting another SpecialPage is very complicated, although not impossible.
Targeting the same SpecialPage is probably easier for the developer AND the user.
 Path: /includes/HTMLForm.php
 Introduction: http://www.mediawiki.org/wiki/HTMLForm
 Tutorial: http://www.mediawiki.org/wiki/HTMLForm/tutorial
 Path to FormSpecialPage class: /includes/SpecialPage.php
24, rue de Bâle
68300 Saint-Louis (France)
tél. +33 6 87 75 99 27
Wikitech-l mailing list
Wikitech-l [at] lists