Template talk:Exams

Latest comment: 1 year ago by Toad40 in topic Proposed edit of template

Proposed edit of template edit

I think someone screwed up when making this template.

The "your name" parameter is where you have to put the date, and the "date you will be back" is where you have to put your name. Can someone fix this? I would fix it myself, but when I was trying to edit the source for the template, I realized that editing a template is something that I don't know how to do. Toad40 (talk) 13:47, 6 May 2022 (UTC)Reply

I'll try to fix it myself, but if I can't fix it. I'll just undo my changes and let someone else fix it. Toad40 (talk) 13:48, 6 May 2022 (UTC)Reply
Ok, I tried. However, I know nothing about fixing templates. Toad40 (talk) 13:59, 6 May 2022 (UTC)Reply

The "your name" parameter is where you have to put the date, and the "date you will be back" is where you have to put your name. Can someone fix this? I would fix it myself, but when I was trying to edit the source for the template, I realized that editing a template is something that I don't know how to do.

@Toad40: The issue here is that Soumya-8974 tried to re-write the template a few years back but other editors disagreed and reverted their changes. The editor who undid their edits to the template forgot to undo their changes to the documentation page though, so we ended up with a template that expected the old parameter ordering, but documentation that listed the new parameter ordering. I've fixed the template documentation so it lists the parameters in the correct order. 163.1.15.238 (talk) 16:19, 6 May 2022 (UTC)Reply
Just thought you might also find it useful to know why your attempted fix didn't work. you can use this template with either zero, one or two parameters, {{exams}}, {{exams|your name}} or {{exams|date you will be back|your name}}. The if statement in the template {{#if: {{{2|}}} |{{{2|}}}|{{#titleparts:{{ROOTPAGENAME}}|1}}}} is checking how many parameters you have supplied and whether the template should be operating in two parameter or one parameter mode - this basically says "if parameter 2 exists then Name=parameter2, if parameter 2 doesn't exist Name=parameter1, if parameter1 is empty use the Name of the Page it's been put on without prefix" (that's what the {{ROOTPAGENAME}} WP:Magic word does). When you swapped the 1's and 2's in that bit of code you changed it to say "if parameter 1 exists then Name=parameter1, if parameter 1 doesn't exist Name=parameter2 ..." which can't work because you can't have parameter 2 without parameter 1. 163.1.15.238 (talk) 16:34, 6 May 2022 (UTC)Reply
OOOhhhh, that explains it. Anyways, thanks for fixing it! Toad40 (talk) 17:02, 6 May 2022 (UTC)Reply