Extension talk:SimpleCalendar

Source code displaying on page
This extension is not working for me. When enabled, all code from the script starting from "setFunctionHook" to the end is displayed at the top of my Main Page. Any ideas? Thanks. --Joshuaholland 20:57, 30 April 2007 (UTC)
 * The script being displayed in the output page usually means that the php opening delimeter (&lt;?) is missing. --Nad 22:23, 30 April 2007 (UTC)
 * I have the opening delimiter (&lt;?) there, and it is interesting that the code desplayed on the Main Page starts at setFunctionHook and not at the beginning of the script, which is what you think would happen if the &lt;? was missing. Josh 00:45, 1 May 2007 (UTC)
 * Hmmm that's pretty weird alright, what's the way you've included it into localsettings? is it pasted directly in, or included as a file? are other extensions working? --Nad 01:47, 1 May 2007 (UTC)
 * That character before setFunctionHook is a "&gt;", so my guess is that you've pasted the code directly into LocalSettings rather than including from file, and therefore there should be no delimeters since it's already in php context (it would make the opening delimeter a tag which would close when it got to the &gt; before the setFunctionHook) - just a guess tho ;-) --Nad 01:50, 1 May 2007 (UTC)
 * Okay, I just made it <?php and then it worked... Josh 02:43, 1 May 2007 (UTC)
 * Cool, ok I guess I should really make the tags like that for everything. --Nad 02:55, 1 May 2007 (UTC)

Could I create tasks whose title have some variables

 * I want to create some tasks with titles like "Michael's log 2007_05_01" instead of ""Michael's log 2007_05_01_01_MAY_2007" by using ( and "&preload=Template:Michael's log", any ideas? Thinks!--Roc michael 12:59, 1 May 2007 (UTC)
 * I'm not sure completely what you mean, but the query-string bit is a good idea which I've just added. I've changed to named parameters now instead of an ordered list, and added a new query parameter which allows query-string items to be added to the newly created dates. --Nad 23:45, 1 May 2007 (UTC)
 * Hi, Thank you very much! How wonderful it is that we can use peload parameter on the Calendar. I am Chinese in Taiwan and I want to use this extension and DPL in my wiki located in a intranet. So the people here would more like to use the date form of task title like "2007/05/02" than "02/May/2007" or "2007/May/02". I guess that Japanese people may think so. So if we can choose which date form we can use that will be a nice thing. Thank you!--Roc michael 15:00, 2 May 2007 (UTC)
 * I added another parameter called format, you can change to the format you asked for of 2007/05/02 with the following,
 *  
 * Thank you, Nad. I appreciate you for what you did.--Roc michael 13:35, 3 May 2007 (UTC)

Adding a prefix to day links?
$table .= "|$t|$day\n";" and mostly it works, but it seems there should be a more elegant way. Also, this makes the subpage have a colon instead of a slash before it, which is what I want. Thanks. Josh 14:15, 2 May 2007 (UTC)
 * Can the variable $prefix be used like this? I'd like the days to link to a page in the current namespace and subpage.  I tried giving it a value to $prefix but that didn't work.  I was able to code it into this line
 * Actually, I got the formatting to work right, but still wondering if there is a better way for me to code it. Thanks.  Josh 17:00, 2 May 2007 (UTC)
 * I think putting mediawiki-variables in the code like that would just hardwire them into the code when its saved, they wouldn't be dynamic. You can add dynamic prefixes like this:
 *  

Could it be possible that this great calendar could get a new face with a parameter?
When I displayed this great calendar with dpl some people marvel at the wonderful result of the two extensions. But since I've used another calendar (User:Hex2bit/Calendar), some body used to using it. If Simple Calendar could get a new face with a parameter, I think it will be a nice thing. Nad, I believe that you can make it be possible to find a way to Integrate them, right? :-) --Roc michael 01:21, 8 May 2007 (UTC)
 * Not sure about that, you'll need to explain in more detail what you're wanting to be done... do you mean a skin? It defines all its parts with CSS classes so you can change the look of it easily. --Nad 04:00, 8 May 2007 (UTC)


 * Yes, Some people like the interface of calendar (User:Hex2bit/Calendar). It can be used to show which members in a department on duty at each day. But unfortunately, It cannot generate articles with custom-made titles. Especially,something like "2007/05/07". Nowadays, it can only use like "2007/5/7" to be a title of an article and it disadvantage working with DPL to list all the events. On the other hand, Simple Calendar is a Parser function extension. So it well be more useful than other calendar extensions.
 * The skin of Simple Calendar is good for some of my coworkers, but others prefer the one which User:Hex2bit/Calendar used ,particularly, to be used for a public calendar.
 * Nad, sorry, I am not a programer, :-( I can only use a few CAD softwares and edit some simple web pages with Dreamweaver. I very like Mediawiki, because it is powerful, useful and has countless advanced programers 'like you' to improve itself. So please do me a favor, Nad.--Roc michael 13:01, 8 May 2007 (UTC)

Could I use the functions preload and format in the same time
Nad, if I use the preload function, it seems that I cannot use the format function which like the followed all together.

Could you give me a hand?--Roc michael 16:04, 8 May 2007 (UTC)
 * Use pipes to separate the parameters in a parser-function or template, eg:


 * Thank you! Nad.--Roc michael 11:27, 9 May 2007 (UTC)

Remove # character in parser-function name on 1.6.x
Hey Nad - first of all, I wanted to thank you very-very much; I really appreciate all this wiki-work you do, and I wish I could do the same, in order to publish these works freely...

Anyway, I liked your SimpleCalendar extension, but I just couldn't make it work, I don't know why... I'll detail here the phases I have done in order to make it work, and I'll be happy if you could tell me what have I missed/done wrong.

I do have experience with extensions; I have built some of my own (too specific to be included here... :-) ).

Here it is: include('extensions/SimpleCalendar.php');
 * I have created the file SimpleCalendar.php
 * I have copied into it the text from here:
 * Saved and uploaded to the extensions folder.
 * Inserted the following line into LocalSettings.php -
 * Uploaded that file (into the root directory)

First testings:
 * In my version page, I can see your credit (Simple Calendar (version 1.2.1, 2007-05-07), A simple calendar extension, by User:Nad )
 * I have created a "test" page, and put there only the following code:
 * Saving; refreshing; nothing. All I see is this:

It just ignores the extension, somehow.

Other extensions, as I said, work; I also installed the "Extension:Variables", and if I enter the following input in the test page: I save and get the following output: (Demowiki is the username...)

That's it, I think...

Oh - and I have:
 * 1)  MediaWiki: 1.6.10
 * 2) PHP: 4.4.1 (cgi)
 * 3) MySQL: 4.0.27-standard

If it matters.

Thanks ahead! Peleg 08:27, 13 May 2007 (UTC)
 * No problem - on MediaWiki version 1.6.x the parser functions don't use the # character by default, just remove that, eg
 *  
 * I've updated the Extension:Simple Calendar page to have a note about this. --Nad 21:37, 13 May 2007 (UTC)
 * hehe... AS simple as that... Thanks!! Peleg 07:27, 14 May 2007 (UTC)

Wrong link colouring
I've just installed the new version of the calendar and I have a problem... All the links (dates) are external links: http://img260.imageshack.us/img260/2333/sanstitrets6.png And I still have the problem of the language... I don't have access to the configuration server. YeTi 20:39, 3 May 2007 (NZST)
 * I'm experiencing this same issue. Anybody find a resolution? Jaofos 05:06, 30 May 2007 (NZST)
 * Did you add the CSS rule #bodyContent table.month a { background:none; padding:0 }? that makes the links plain --Nad 08:47, 30 May 2007 (NZST)
 * Yes, I figured out afterwards to add the styles for the calendar and everything works great. I have, however, run into another issue where after you add entries for a calendar day, the link will not change to indicate an existing entry for that day until after you edit and save the page with the  tag. Jaofos 02:59, 12 June 2007 (NZST)
 * I've tried adding a line into the code to disable the caching for calendar tables, but your problem doesn't happen on our wiki's, so I can't test it, give it a go now and see if it works any better --Nad 22:28, 11 June 2007 (UTC)

Other languages
Hi, a few questions:
 * How can I put the calendar in another language, for example french (january = janvier, etc...)?
 * I changed it slightly to work with locales, so download again from MW:Extension:Simple Calendar, and then set the PHP locale in LocalSettings.php with the following (the locale's must be configured on the server properly),
 * setlocale(LC_ALL,'fr_FR','fr','FR','french','fra','france','French','fr_FR.ISO8859-1');
 * if that doesn't work, use locale -a from your server's shell to see what local's are available.


 * In which file do I have to put the CSS code, knowing that I use the Monobook skin? --YeTi 19:58, 1 May 2007 (NZST)
 * You can add it to your MediaWiki:Monobook.css file, see our MediaWiki:Wikiskin.css for example. --Nad 21:08, 1 May 2007 (NZST)

Links showing up as external
I've just installed the new version of the calendar and I have a problem... All the links (dates) are external links: http://img260.imageshack.us/img260/2333/sanstitrets6.png And I still have the problem of the language... I don't have access to the configuration server. YeTi 20:39, 3 May 2007 (NZST)
 * I'm experiencing this same issue. Anybody find a resolution? Jaofos 05:06, 30 May 2007 (NZST)
 * Did you add the CSS rule #bodyContent table.month a { background:none; padding:0 }? that makes the links plain --Nad 08:47, 30 May 2007 (NZST)
 * Yes, I figured out afterwards to add the styles for the calendar and everything works great.

Link colour not changing to indicate newly created entry
I have, however, run into another issue where after you add entries for a calendar day, the link will not change to indicate an existing entry for that day until after you edit and save the page with the tag. Jaofos 02:59, 12 June 2007 (NZST)
 * I've tried adding a line into the code to disable the caching for calendar tables, but your problem doesn't happen on our wiki's, so I can't test it, give it a go now and see if it works any better --Nad 22:28, 11 June 2007 (UTC)
 * Seems to be working now, thanks! --Jaofos 02:37, 13 June 2007 (NZST)

CSS style
The CSS style to any calendar containing articles can be applied using Extension:CSS now --Zven 20:44, 1 July 2007 (UTC)

Unable to get individual days in calendar to link properly

 * Running MediaWiki version 1.10 on latest version of XAMPP (running as localhost on my own Windows XP machine)
 * Using Simple Calendar version 1.2.2 from Organic Designs wiki site (having edited minor syntax error in the loop in the function that displays calendar from passed month and year).
 * calendar.php resides in my extensions directory.
 * LocalSettings.php includes the line include( "extensions/calendar.php" );
 * Calling the calendar display on the wiki page with the line

The calendar display is visually perfect. However, every individual date links to the same page, July 2007, without including the actual day value in the link.

If I call the calendar using, now I get date links but the table alignment for the first line of dates is offset to the right by the width of the calendar display, and negative dates are displayed (meaning for example that the display would include -13 as a date, which links to a date 13 days prior to July 1 2007 in this example).

The page July 2007 existed prior to the installation of Simple Calendar, if that is relevant.

Any thoughts, anyone? Clingonkelt 19:20, 15 July 2007 (UTC)
 * There shouldn't have been a syntax error to fix because it's the same version which is running properly on the organicdesign site... what was the error? is it possible to see the faulty site or is it behind firewall? --Nad 06:43, 16 July 2007 (UTC)

Calendar Is There But As a Newby I have no Idea what to do with the CSS data
I like your SimpleCalendar extension, but I just couldn't make it work, I don't know why... I'll detail here the phases I have done in order to make it work, and I'll be happy if you could tell me what have I missed/done wrong. (OK you've heard this all before I know but...)

Here it is:

* I have created the file SimpleCalendar.php (from the Organic Design site) * Saved it to the extensions folder. * Inserted the following line into LocalSettings.php - include('extensions/SimpleCalendar.php');

Struggled with the CSS data, finally put it in Main.CSS (in the Skins/Monobook folder)

First test implementation: * Added Calendar|Calendar to the Sidebar * Created a page called Calendar added * Clicking menu item I get a year calendar called "Calendar" but no formatting/styles are applied the calendar days/months. * Hovering over a day doesn't give you a date, just a month. * Clicking a date creates a new page but the page is dated only by the month not the date. That's it, I think...

Oh - and I have:

1. MediaWiki: 1.10.1 2. PHP: 5.2.3 (cgi) 3. MySQL: 5.0.24 4. IIS 5. Windows 2K3

Any suggestions would be much appreciated

Prevaljo
 * First of all, you should remove the changes you made to the main.css file and put the css rules into the MediaWiki:Common.css article. You should never change any files which are part of the mediawiki installation, only LocalSettings.php and the extension files should ever be changed.
 * If you can't give me a URL to your wiki (due to firewall, intranet etc) then maybe give me the html source of the faulty calendar page and I'll see if I can figure out what's wrong with it. --Nad 22:01, 9 August 2007 (UTC)
 * Thanks for this rapid feedback NAD, however for whatever reason let's assume caching I can now see your calendar. In the correct format with styles... (Newbys DUH)

Date Format
One issue remaining was the fact that the day/month links all pointed only to a single month but by using the suggestion from "Clingonkelt" above to change the  to  the date issue is now resolved I'm not sure if I like the articles being referenced numerically buy day eg as 14/6/2007 but I can work on that. I will revisit the changes I made to the Main.CSS stylesheet and see if puting them in Mediawiki:common.css article gives me the same result, many thanks again. Prevaljo
 * You can use that format parameter to make the date any format you like - how did you want it to be? Also when you make any changes to CSS you may have to do a ctrl+shift+refresh to force the browser to reload page dependencies since a normal refresh will only reload the page html. --Nad 05:33, 10 August 2007 (UTC)
 * I would have agreed but it would appear you can't put text in using the date format, so I have been unable to have 01/March/2007 but I'm not loosing sleep over it. Prevaljo 06:07, 10 August 2007 (UTC)
 * That format should be fine, you'd use format=%d/%B/%Y. if that doesn't work it may be a problem with your PHP locale settings. The default format is %e %B %Y which should give 1 March 2007. --Nad 07:55, 10 August 2007 (UTC)

Little error
When I install the extention I have this error on the top

TheEnd, le 7 septembre 2007 à 21:45 (WET)
 * Not sure what that can be... Line 78 is the last line of the code, do you have the closing php-delimiter (&gt;) on the end of the simplecalendar.php script? --Nad 21:21, 7 September 2007 (UTC)

Check to make sure there is not an extra line break at the end of the PHP part after you pasted it, that is what messed it up for me.

Combination with Simple Form ?
Hi Nad. Could it be possible the extension combine with Simple Forms like followed: and the content of Template:calendar_input_form is like followed: {{#form:method=post|style=width:400px| Description: {{#input:type=textarea|style=..... }} Thanks! --Roc michael 03:41, 21 September 2007 (UTC)
 * First, When we create a calendar page, we can use both functions "preload" and "form".
 * Second,When we edit a existing calendar page, we can use "form" function to do it.

Could you give me a i18n file on this extension
Hi Nad. Could you give me a i18n file on this extension for changing the titles of month and week in the calendar? Than everyone in different language can offers his own language in the file.--Roc michael 02:50, 13 October 2007 (UTC)
 * I started creating one and then realised that MediaWiki already has the names of all the days and months in all languages, so I just need to adjust the code to use those existing messages. I'll do that as soon as I get some time. --Nad 03:44, 13 October 2007 (UTC)
 * Test out the latest version and let me know if its working for your language properly. You need to add a parameter to your calendar statement though called dayformat which should be set to %a for abbreviated day names, or %A for full day name. --Nad 07:23, 13 October 2007 (UTC)
 * Nad. Thank you. Your work is better than I thought and you can see it at here --Roc michael 09:42, 13 October 2007 (UTC)
 * That looks cool! I can't speak or read Chinese, but I've always loved the look of the characters and have studied 八卦 philosophy from English translations for many years. --Nad 10:10, 13 October 2007 (UTC)
 * It's interesting. I'd seen the Eight Trigrams at your web pages before. Though, I'v studied The History of Chinese Philosophy at National Open University in Taiwan. I'v never learn things on 易經(The Book of Changes). It's a fantastic ancient philosophy and I could not image that a expert of computer science as you are would be enthusiastic at such an ancient Chinese philosophy. The Characters at the picture SimpleCalendar.png are difference with those at my calendar because the interface you select is ancient Chinese and mine is Tradition Chinese(just contrary to Simple Chinese). I am very happy to know you like the old culture and thank for your help.--Roc michael 13:46, 15 October 2007 (UTC)

I get his crazy error!
[Wed Oct 17 12:54:08 2007] [error] [client 10.145.120.31] PHP Fatal error: Call to a member function exists on a non-object in /PATH/extensions/SimpleCalendar/SimpleCalendar.php on line 69, referer: http://DOMAIN/wdev_wiki_new/index.php?title=Simple_Calendar_Extension&action=submit

This error refers to the wfRenderMonth Function and the lines below. $class = $title->exists ? 'day-active' : 'day-empty'; $url = $title->getFullURL($title->exists ? '' : $query); Why am I getting this error?

Thanks, Pete.


 * What version of PHP/MW? It must mean that the prefix you're using is making an invalid title. I've made the code slightly more solid so that it won't die in this situation, instead it shows the title it was trying to make which may help solve the problem. --Nad 19:46, 17 October 2007 (UTC)


 * From my Special:Version page: MediaWiki: 1.11.0 PHP: 5.1.6 (apache2handler) MySQL: 4.1.20 Have you uploaded this new more solid version? --Pete 20:57, 17 October 2007 (UTC)


 * I go tthe new version from the http://www.organicdesign.co.nz/Extension:SimpleCalendar.php Wiki and it works great. Thank You Very Much.! --Pete 21:04, 17 October 2007 (UTC)

Issue with Firefox v 2.0.0.8??
I just inherited admin duties on our wiki at work. We have a local user that just upgraded to FF2.08, and now he sees one line of the calendar (not functioning) and code at top. Please help.

Thanks, patrick 10:15, 22 October 2007 (UTC)
 * If you're seeing the calendar's php code, then that must mean you've missed out an opening php delimiter "<?php" in the extension file. --Nad 21:12, 22 October 2007 (UTC)

Installation - 500 Error
I am trying to install the Simple Calendar and am having some errors. I copied the php code and created a file called SimpleCalendar.php in my extensions directory. I then went to my LocalSettings.php and added the line: require_once( "$IP/extensions/SimpleCalendar.php" ); After I save the LocalSettings.php file and refresh my site, I am getting a 500 Error. As soon as I comment that line, and refresh it works again. I have opening and close php tags in the extension file, and I have tried to remove the closing php tag from the extension file (I have one extension that doesn't have the closing tag, since it is closed in Local Settings). Nothing seems to fix the problem, any help would be appreciated. Thanks, Shane
 * Not really sure why, but I moved it up an area in my LocalSettings.php file and it started to work without any issues. -Shane
 * 500 just means there's a script error - you'll need to turn on error reporting or check the php error log to see exactly what the problem is, let me know that info and I should be able to be of more help. --Nad 21:23, 6 November 2007 (UTC)

Time zone
My server uses a different time zone than me, so I always enter the correct offset in my preferences to get around this issue. However, setting your offset in preferences does not affect the calendar. It still uses the server time zone. I think it would be a valuable improvement for this extension to dynamically determine the time zone for each user so the darkened cell used to indicate the current day is always accurate.

Does the author have any plans to implement such a feature?

I have come up with a workaround utilizing the $TZ environment variable in Unix-like systems. Place these lines after  in  : putenv("TZ=insert time zone here"); Where insert time zone here should be a valid time zone for your system. --Dmnt 04:43, 12 November 2007 (UTC)
 * 1) set the timezone

Embed calendar in sidebar?
Is there a way to embed a calendar (one month) in the sidebar (MediaWiki:Sidebar)? If so, how? If not, are there any plans to make this possible? Thanks! --Dmnt 05:19, 12 November 2007 (UTC)
 * See Manual:Interface/Sidebar for a skin hack which allows you to put any wikitext in your sidebar article. --Nad 20:22, 12 November 2007 (UTC)
 * That hack worked great. Sorry I missed that originally. Unfortunately, the calendar is a little too wide to fit into the sidebar with the provided CSS. I fixed it by changing the  for   to  . However, I don't want this to be applied to all the calendars I display on my wiki. Should there be a   option for the extension, or am I overlooking something simple? Thanks! --Dmnt 01:26, 13 November 2007 (UTC)