FeralSimpleCalendar

Summary: A small simple calendar suitable for a rightbar, or header/footer or anywhere you wish.
Version: 2007-03-15
Prerequisites: None.
Status: New derivative code base but solid;
Maintainer: Feral
Categories: blog,pim,calendar

Questions answered by this recipe

How do I place a small calendar displaying the current date on a wiki page?

This recipe will do just that, and only that.

Description

A small simple calendar, ONLY.

Appearance by default is such:

Image displays both day start styles, and bottom date separators, examples

  • Left -- (default)
    • $feralsimplecalendar_weekstart= 0; // Start on Sunday;
    • $feralsimplecalendar_bottomsmalldatesep = '-'; // 2007-03-15
  • Right:
    • $feralsimplecalendar_weekstart= 1; // Start on Monday;
    • $feralsimplecalendar_bottomsmalldatesep = '/'; // 2007/03/15

Installation

Download feralsimplecalendar.phpΔ and copy to cookbook folder. Add to config.php:

include_once("$FarmD/cookbook/feralsimplecalendar.php");

feralsimplecalendar-20181207.phpΔ is an update to the 2007/03/15 version that addresses “Warning: preg_replace(): The /e modifier is no longer supported” issues (tested on pmwiki-2.2.110).

feralsimplecalendar-20260401.phpΔ is a rewritten Markup version compatible with PHP 8.2.

Rename the downloaded file to feralsimplecalendar.php.

To use this recipe, write (:feralsimplecalendar:) whereever you want the calendar to show.

Customization:

Start on which day:

  • Start on Sunday
    • $feralsimplecalendar_weekstart= 0; // Start on Sunday;
  • Start on Monday
    • $feralsimplecalendar_weekstart= 1; // Start on Monday;

Starting on Sunday is default.

Bottom Small date separator:

This is the date separator for the small date at the bottom left of the calendar;

  • 2007-03-15
    • $feralsimplecalendar_bottomsmalldatesep = '-'; // 2007-03-15
  • 2007/03/15
    • $feralsimplecalendar_bottomsmalldatesep = '/'; // 2007/03/15

I believe any char can be used but I have only tested with the above.

The 2007-03-15 separator format is default.

Day names:

  • By default we use standard USA abbreviations:
    • $feralsimplecalendar_dayname = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  • The long version would be:
    • $feralsimplecalendar_dayname = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

Change as you desire...

Colors:

Simply define $HTMLStylesFmt['feralsimplecalendar'] before you include feralsimplecalendar.php;

This should contain:

  • div#feralsimplecalendar
  • table.feralsimplecalendar
  • table.feralsimplecalendar caption
  • table.feralsimplecalendar th
  • table.feralsimplecalendar td
  • th.feralsimplecalendar-daynames
  • td.feralsimplecalendar-blank
  • td.feralsimplecalendar-today
  • td.feralsimplecalendar-day

See feralsimplecalendar.php for the default values.

Notes

The calendar code is pretty much blank slate; All my tests show it working/perfect but don't bet your life on it. ;)

Release Notes

  • 2007-03-15: Initial
  • 2026-04-01: Updated for PHP 8.2

See Also

Contributors

Comments

See discussion at FeralSimpleCalendar-Talk

User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_COOKIE] => PHPSESSID=4ni9b3h17s4lsthf38paa3h0h5; imstime=1777524434
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fFeralSimpleCalendar
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fFeralSimpleCalendar
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/FeralSimpleCalendar
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/FeralSimpleCalendar
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afLe5i0m6WG4dDPeIFSKMwAAAFg
            [REDIRECT_URL] => /wiki/Cookbook/FeralSimpleCalendar
            [REMOTE_ADDR] => 216.73.216.25
            [REMOTE_PORT] => 6973
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/FeralSimpleCalendar
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/FeralSimpleCalendar
            [SCRIPT_URL] => /wiki/Cookbook/FeralSimpleCalendar
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afLe5i0m6WG4dDPeIFSKMwAAAFg
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777524454.7237
            [REQUEST_TIME] => 1777524454
            [argv] => Array
                (
                    [0] => n=Cookbook%2fFeralSimpleCalendar
                )

            [argc] => 1
        )

)