It's very difficult for me to explain, but attaching these two pictures will help better. How do I code in a way I just add a digit number after the parameter's name in order to add a new info in a row without adding extra codes in the template, because would be more unnecessary large.
#How to code a template to add many group fields inside a template
18 messages · Page 1 of 1 (latest)
Like a dynamic Template with a Plus X raw if said condition ? No idea but if I can make your request clearer then it's already something
...
Sorry tried 😅
First time, buddy?
Kinda, found a way but don't know if you will like it, testing on my side first. I had a expression at first but it was creating a loop.
Ok, show it.
Oh wait, looking at it now it looks like yours but yours is better since you don't have the amount input 🤔
(Where is canada when you need it?)
Too far i'm afraid XD
So you want a variable amount of parameters in your template?
I thought I had an idea but it didn't work, so I admit it's beyond my capabilities. Sorry really wished I could have helped.
{{#forargs}} from Extension:Loops is probably the easiest solution for this:
https://www.mediawiki.org/wiki/Extension:Loops##forargs_(experimental)
Alternatively you could write a Lua module with Scribunto that loops through the arguments
Yes. Tried to code an example, but it's broken.
How could I implement that?
Yeah, there really is not any easy and nice way to do that with pure wikitext, I don't think. You are probably gonna have to look at Lua for that. I don't really know much about the specifics of Lua though, to really give you an example
According to the docs, something like this should work (untested):
{{#forargs: title
| key
| value
| Title: {{#var: value }}
Description: {{{description{{#var: key }}}}}
}}
This shows the title and description for each title + description you enter, ofc you have to replace that text with the actual template/content you want to display for each entry