[Mediawiki-l] Try to build a complicated template that n00b users could use

Dr JFBurté burtejf at orange.fr
Mon Apr 7 10:44:52 UTC 2008


A little bit of answer to myself :

1°) Perharps there are two ways to build such a template
.. template whose code only used "one level" test with ParserF using both 
{{{3|{{{2|1}}}}}} and ParserF #if and #switch
.. "loop template" whose code can tests missing parameters in a better 
structured cascads of choices, and so loops in itself with constructing the 
missing parametres by default

2°) And I just learn that MediaWiki's parsing knows how to recognize named 
and unnammed parameters
so that {{template|named1=..|named2=|notnamed}} could be equal to 
{{template|named2=|named1=}} or to {{template|notnamed|named1=}
.. is that right ??

Which one is the faster/better option ?
Thank's @+

----- Original Message ----- 
From: "Dr JFBurté" <burtejf at orange.fr>
To: <mediawiki-l at lists.wikimedia.org>
Sent: Monday, April 07, 2008 10:57 AM
Subject: [Mediawiki-l] Try to build a complicated template that n00b 
userscould use on may Wiki


Hi
I need an example of Template with {{{3|{{{2|1}}}}}} (with ParserF #switch
or in #if/#ifeq/etc ) that runs whith all or none parameters (cf infra)

Why ?
Because I'm looking for the syntax to test some variables to run in only one
unified Template {{Plan}} that should render differently in different
NameSpaces and with different variables ( before I used several template,
but I want to use only one ;O))

This Template aims to dysplay a latéral Help Menu (like InfoBox) in a lot of
pages, only by including a subpage/TdM with various choices

This three different variables are :
{{{1}}} : the name of the Page to look for Page/TdM for inclusion
{{{f}}} : the format of the dysplay (with or without footer choices)
{{{p}}} : a choice between several namespace of my Wiki (Aide, Projet,
Modèle, etc)

{{Plan}}, alone(by default ), will search/dysplay Aide:PAGENAME/TdM
=> {{Plan}} in page [[Aide:Accueil]] will include [[Aide:Accueil/TdM]]
.. that's very simple but I need more capacities
... so I'm looking for :
{{Plan|OtherPAGENAME}} will dysplay Aide:OtherPAGENAME/TdM
{{Plan|OtherPAGENAME|f=court}} (choice court|:long by default) will dysplay
un shortiest one
{{Plan|ThisOtherPAGENAME|p=projet}} (choice within page|projet|portail|:aide
by default) will search the /TdM in other page Projet:ThisOtherPAGENAME/TdM

ToDay : This works well when I respect writing all the parameters
My problem : How to use {{{3|{{{2|1}}}}}} in #switch or in #if/#ifeq/etc
make possible all the possibilities with 0, 1 or 2 parameters by future
users ?

Could you point me such a kind of Template, so I could learn ?



_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l



-- 
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.8/1362 - Release Date: 06/04/2008 
11:12






More information about the MediaWiki-l mailing list