1

First let me show you how my current wiki entry looks like and what parameters I've set:

{{tracklist|Track1=Pokerface|Track2=Yellow Submarines|Track3=Yesterday}}

My goal is to generate a tracklist using a template, which is actually a table. In the left column there has to be the songnumber, and in the right column the songname.

To achieve this, I created a new wiki template, where I am using the loop function #while to count upwards and check if a song with such a number exists. You can find it on the end of my text.

Currently, I do not understand, why my code does not create a complete table. Only the first song gets print out. Someone able to help me?

{|
{{#vardefine: cTrack|1}}

{{#while:
|{{{Track{{#var:cTrack}}|}}}
|
{{!}} {{#var:cTrack}} {{!!}} '''{{{Track{{#var: cTrack}}}}}'''

{{#vardefine: cTrack|{{#expr: {{#var:cTrack}} + 1}}
{{#if: {{{Track{{#var:cTrack}}|}}} | {{!}}- }}
}}
}}
|}
Termininja
  • 6,620
  • 12
  • 48
  • 49
Otaku Kyon
  • 415
  • 1
  • 9
  • 19

1 Answers1

1

Probably this is some bug, I can't explain it..., but I found how to fix it: you just need to add table row {{!}}- before and after table data {{!}}. By the way the if statement is not needed. Try this:

{|
{{#vardefine: cTrack|1}}

{{#while:
  |{{{Track{{#var:cTrack}}|}}}
  |
{{!}}-
{{!}} {{#var:cTrack}} {{!!}} '''{{{Track{{#var: cTrack}}}}}'''
{{!}}-

{{#vardefine: cTrack|{{#expr: {{#var:cTrack}} + 1}}}}
}}
|}
Termininja
  • 6,620
  • 12
  • 48
  • 49