This is the
talk page for discussing improvements to the
Day+1 template. |
|
![]() |
Template:Day+1 is permanently
protected from editing because it is a
heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by
consensus, editors may use {{
edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's
documentation to add usage notes or
categories.
Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here. |
![]() | Text and/or other creative content from this version of Template:Day+1 was copied or moved into incubator:Template:Wp/nod/day+1 with this edit. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
Isn't the code of this template ridiculously strainful on servers? As far as I can tell it is directly {{ switch}}ing every possible date for the one after it. This all could be achieved much more neatly with {{calcadd}} and only 12 or so switches. -- Alfakim -- talk 02:35, 28 March 2006 (UTC)
{{switch | {{CURRENTMONTH}} {{Calcadd| 1 + {{CURRENTDAY}} }} | case: January 32=February 1 | case: February 29=March 1 | case: March 32=April 1 | case: April 31=May 1 | case: May 32=June 1 | case: June 31=July 1 | case: July 32=August 1 | case: August 32=September 1 | case: September 31=October 1 | case: October 32=November 1 | case: November 31=December 1 | case: December 32=January 1 | default={{CURRENTMONTH}} {{Calcadd| 1 + {{CURRENTDAY}} }} }}
switch
options are ignored by the server (because they always point to nonexistent parameters). The current day+1
template, however, involves about the same amount of nesting (a tad more I think), but, crucially, countless non-nested templates (i.e. very many occurences of switch
(update: I meant, qif
occurences), and it was this that I was worried about for the server.--
Alfakim --
talk 13:07, 29 March 2006 (UTC)switch
". The current 'day+1' only uses ONE 'switch' call except on February 28 and December 31 (when it uses two)... it thus actually has fewer 'switch' statements then what you are proposing. It does have a lot of 'qif' statements, but those are all for purposes of making the 'year' optional. Pages like
Wikipedia:Selected anniversaries/January 1 increment by date without a year while
Wikipedia:Tip of the day/April 21, 2006 include a year. I suppose this could be split into with/without year copies to remove all the 'qif' statements if there is concern about the time spent evaluating them. --
CBDunkerson 13:39, 29 March 2006 (UTC)
When using {{CURRENTYEAR}} after this template, on December 31 the day and month will coreect (January 1) but the year will be the current year (a year early). Instead of {{CURRENTYEAR}}, use:
{{#ifeq: {{Day+1}} | January 1 | {{#expr: {{CURRENTYEAR}} + 1}} | {{CURRENTYEAR}}}}
One December 31 it gives the next year; all other days it gives the current year.
Good advice. -- Meno25 15:13, 26 November 2006 (UTC)
{{ editprotect}} Please added <noinclude>{{Documentation}}</noinclude>. Thanks. -- Suntag ☼ 12:42, 4 October 2008 (UTC)
Would someone please eyeball the documentation? There are MediaWiki error messages in it, which might be symptomatic of bad code in the template. -- Fullstop ( talk) 21:56, 26 December 2008 (UTC)
Done. And the same for Template:Day-1. Debresser ( talk) 12:49, 15 March 2009 (UTC)
This is the
talk page for discussing improvements to the
Day+1 template. |
|
![]() |
Template:Day+1 is permanently
protected from editing because it is a
heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by
consensus, editors may use {{
edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's
documentation to add usage notes or
categories.
Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here. |
![]() | Text and/or other creative content from this version of Template:Day+1 was copied or moved into incubator:Template:Wp/nod/day+1 with this edit. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
Isn't the code of this template ridiculously strainful on servers? As far as I can tell it is directly {{ switch}}ing every possible date for the one after it. This all could be achieved much more neatly with {{calcadd}} and only 12 or so switches. -- Alfakim -- talk 02:35, 28 March 2006 (UTC)
{{switch | {{CURRENTMONTH}} {{Calcadd| 1 + {{CURRENTDAY}} }} | case: January 32=February 1 | case: February 29=March 1 | case: March 32=April 1 | case: April 31=May 1 | case: May 32=June 1 | case: June 31=July 1 | case: July 32=August 1 | case: August 32=September 1 | case: September 31=October 1 | case: October 32=November 1 | case: November 31=December 1 | case: December 32=January 1 | default={{CURRENTMONTH}} {{Calcadd| 1 + {{CURRENTDAY}} }} }}
switch
options are ignored by the server (because they always point to nonexistent parameters). The current day+1
template, however, involves about the same amount of nesting (a tad more I think), but, crucially, countless non-nested templates (i.e. very many occurences of switch
(update: I meant, qif
occurences), and it was this that I was worried about for the server.--
Alfakim --
talk 13:07, 29 March 2006 (UTC)switch
". The current 'day+1' only uses ONE 'switch' call except on February 28 and December 31 (when it uses two)... it thus actually has fewer 'switch' statements then what you are proposing. It does have a lot of 'qif' statements, but those are all for purposes of making the 'year' optional. Pages like
Wikipedia:Selected anniversaries/January 1 increment by date without a year while
Wikipedia:Tip of the day/April 21, 2006 include a year. I suppose this could be split into with/without year copies to remove all the 'qif' statements if there is concern about the time spent evaluating them. --
CBDunkerson 13:39, 29 March 2006 (UTC)
When using {{CURRENTYEAR}} after this template, on December 31 the day and month will coreect (January 1) but the year will be the current year (a year early). Instead of {{CURRENTYEAR}}, use:
{{#ifeq: {{Day+1}} | January 1 | {{#expr: {{CURRENTYEAR}} + 1}} | {{CURRENTYEAR}}}}
One December 31 it gives the next year; all other days it gives the current year.
Good advice. -- Meno25 15:13, 26 November 2006 (UTC)
{{ editprotect}} Please added <noinclude>{{Documentation}}</noinclude>. Thanks. -- Suntag ☼ 12:42, 4 October 2008 (UTC)
Would someone please eyeball the documentation? There are MediaWiki error messages in it, which might be symptomatic of bad code in the template. -- Fullstop ( talk) 21:56, 26 December 2008 (UTC)
Done. And the same for Template:Day-1. Debresser ( talk) 12:49, 15 March 2009 (UTC)