Template talk:CalendarSingle

From FollowTheScore
Jump to: navigation, search

hey

I've made a preload version of the calendar which directs to Template:Monthly_calendar [1], and if the month calendar doesnt exist yet, creates it. Now to find a few to pass the month-number... Maybe is possible by extracting it from the {{PAGENAME}}.

{{Calendar/MonthStart{{#time:D|{{{year}}}-{{{month}}}-01 +1 second}}
|cur_month={{#time:F|{{{year}}}-{{{month}}}-03}}
|prev_month={{#ifexist: {{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 -1 month}}|[[{{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 -1 month}}|<<]]|[{{fullurl:{{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 -1 month}}|action=edit&preload=Template:Monthly_calendar}} <<]}}
|next_month={{#ifexist: {{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 +1 month}}|[[{{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 +1 month}}|>>]]|
[{{fullurl:{{{basepage}}} {{#time:F Y|{{{year}}}-{{{month}}}-03 +1 month}}|action=edit&preload=Template:Monthly_calendar}} >>]}}

-- Eiland 01:19, 26 August 2007 (CEST)

Date bug

If you look at the calendar, you will see that this month (December 2007) starts on a Friday. This is not correct, it should start on a saturday. You can correct this by changing

{{Calendar/MonthStart{{#time:D|{{{year}}}-{{{month}}}-01 +1 second}}

to

{{Calendar/MonthStart{{#time:D|{{{year}}}-{{{month}}}-02 +1 second}}

. But I really don't think this is the best way to do it. I have it changed this way on my wiki, but I'd really like to see a proper solution.

--El sjaako 03:25, 18 December 2007 (CET)

Reply

For some strange reason the #time function seems to deliver different values under different versions of MW / PHP. Indeed it may be necessdary to use day 1/8/15/22 here or 2/9/16/23. So if months start at the wrong day just change the number here. Maybe sometime there will be a better solution ... Gero 08:38, 22 December 2007 (CET)

Re reply

Hi Gero. Yes. you are right. The early code had run right results in my wiki until I imported the new code you saved the version. Now I've changed it to early right version for me.

My environment
  • Win XP
  • MediaWiki: 1.11.0
  • The AppServ Open Project - 2.5.7 for Windows
    • PHP: 5.1.6 (apache2handler)
    • MySQL: 5.0.24a-community-nt-log