Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 937301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:27:21+00:00 2026-05-15T21:27:21+00:00

I have a calendar application, and in that calendar application, there is a mini

  • 0

I have a calendar application, and in that calendar application, there is a “mini view” of a calendar. That little widget only displays the days of the currently chosen month and when you click the number it opens a new page and sends GET data to that new page (to display MySQL info, etc.)

The point is: this little mini-calendar doesn’t do much at all, and I’m working to turn it into a partial in Zend Framework MVC. We have jQuery as well. I’m wondering if there is any built-in code that will easily do what we are trying to do with our own code.

Our code (done procedurally):

<?php
    /***
      This script file is the left panel calendar (small)
    */

    //Required variables initializion starts (important in the case of create new event, to avoid PHP notices).

    $day    =    "";
    $month    =    "";
    $year    =    "";
    $sel    =    "";
    $what    =    "";
    $page    =    "index.php";
    $param    =    "";
    $index    =    "";
    $functionLast    =    "goLastMonth";
    $functionNext    =    "goNextMonth";
    $sendFunction    =    "sendToForm";

    if(isset($_GET['index'])) //if index page
    {
        $index    =    $_GET['index'];
    }
    if(isset($_GET['type'])) //if sype is set
    {
      $param    =    "&amp;type=".$_GET['type'];
    }
    if(isset($_GET['page'])) //if page is set
    {
        $page            =    "calendar.php";
        $param            =    '&amp;page=calendar';
        $functionLast    =    "getLastMonth";
        $functionNext    =    "getNextMonth";
        $sendFunction    =    "sendToTextBox";
    }

    if(!isset($calWidth) && !isset($calHeight)) //cal width /height check
    {
        $calWidth    =    CALENDAR_WIDTH;
        $calHeight    =    CALENDAR_HEIGHT;
    }

    if(isset($_GET["day"])) //if day is set
        $day = $_GET["day"]; //get it

    if(isset($_GET["month"])) //if month is set
        $month = $_GET["month"]; //..

    if(isset($_GET["year"])) //..
        $year = $_GET["year"]; //

    if(isset($_GET["sel"]))
        $sel = $_GET["sel"];

    if(isset($_GET["what"]))
        $what = $_GET["what"];

    if(isset($_GET['date']))
    {
        $date    =    $_GET['date'];
        list($year,$month,$day) = explode("-",$date); //split date into pieces
    }

    if($day == "") $day = date("j");  //if day is blank, get today

    if($month == "") $month = date("m");  //if month is blank, get this month

    if($year == "") $year = date("Y"); //if year is blank, get this year
    //echo $day."-".$month."-".$year;die;
    //echo '<br>';
    if(!checkdate($month, $day, $year)) { //if not a valida date
      if(isset($_GET["month"]))  { //try to get number of days for this month as this seems the last day of the month. for example if today is 31 of August and you are calling ?month=9&year=2009 it gives you wrong results
        $day = date("t", strtotime($year . "-" . $month . "-01")); //so give you 30.
      }
    }

    $printabledate  = $year."-".$month."-".$day;

    $currentTimeStamp = strtotime("$year-$month-$day");
    $monthName = date("F", $currentTimeStamp);
    $numDays = date("t", $currentTimeStamp);
    $counter = 0;
?>

<br />
<div id="loading1" class="a_loading1">
    <iframe src="<?php echo SITE_URL?>/loading-msg.php" scrolling="no" frameborder="0"  class="markup a_position"></iframe>
</div>

<table  class="mini-cal-table">
    <tr class="tprowbgcolor">
        <td class="arrow" colspan='1' align="center"><input type='button' class='buttonleft' onclick='<?php echo "$functionLast($month,$year,\"$page\",\"$index\")"; ?>' onmousedown="this.className='maincalbutton_active_left'" onmouseout="this.className='buttonleft'" /></td>
        <td class="title" colspan='5'><span class='title'><?php echo $monthName . " " . $year; ?></span></td>
        <td class="arrow" colspan='1' align="center"><input type='button' class='buttonright' onclick='<?php echo "$functionNext($month,$year,\"$page\",\"$index\")"; ?>' onmousedown="this.className='maincalbutton_active_right'" onmouseout="this.className='buttonright'" /></td>
    </tr>
    <tr>
        <td class='wd-titles'>Su</td>
        <td class='wd-titles'>Mo</td>
        <td class='wd-titles'>Tu</td>
        <td class='wd-titles'>We</td>
        <td class='wd-titles'>Th</td>
        <td class='wd-titles'>Fr</td>
        <td class='wd-titles'>Sa</td>
    </tr>
    <tr>
<?php
    for($i = 1; $i < $numDays+1; $i++, $counter++)
    {
        $timeStamp = strtotime("$year-$month-$i");
        if($i == 1)
        {
        // Workout when the first day of the month is
        $firstDay = date("w", $timeStamp);

        for($j = 0; $j < $firstDay; $j++, $counter++)
        echo "<td>&nbsp;</td>";
        }

        if($counter % 7 == 0) {
          echo "</tr><tr>";
        }

        if(date("w", $timeStamp) == 0) {
          //$class = "class='weekend'";
          $tdclass = "weekend";
        } else {
          if($i == date("d") && $month == date("m") && $year == date("Y")) {
            //$class = "class='today'";
            $tdclass = "today";
          }
          else {
            //$class = "class='normal'";
            $tdclass = "normal";
          }
        }
        $zero = "";
        if($i < 10 )
        {
            $zero = "0";
        }
        $month = round($month);
        if($month < 10)
        {
            $month = "0".$month;
        }
        $date  = $year."-".$month."-".$zero.$i;
?>

<td class="<?php echo $tdclass?>"><?php
    if(!isset($_GET['page']))    {
    ?><a href='<?php echo SITE_URL; ?>/agenda.php?date=<?php echo $year; ?>-<?php echo $month; ?>-<?php echo $zero.$i; ?>'><?php echo $i?></a>

<?php }    else    {
?>

<a onclick='<?php echo "$sendFunction($i,\"$date\",$numDays,\"$index\",\"$type\")"; ?>'><?php echo $i?></a>

<?php

}
?></td>

<?php
    }
?>
    </tr>
</table>
<script language="javascript" type="text/javascript">
    //<![CDATA[
    function goLastMonth(month,year,page,index) {
    // If the month is January, decrement the year.
      if(month == 1) {
        --year;
        month = 13;
      }

      var url =

      document.location.href = page+"?month="+(month-1)+"&year="+year+"<?php echo $param?>";
    }

    function goNextMonth(month,year,page,index)
    {
        // If the month is December, increment the year.
        if(month == 12)
        {
            ++year;
            month = 0;
        }
        document.location.href = page+"?month="+(month+1)+"&year="+year+"<?php echo $param?>";
    }
    //]]>
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:27:22+00:00Added an answer on May 15, 2026 at 9:27 pm

    jQuery has many good calendar options, the following being a part of the UI core:

    http://jqueryui.com/demos/datepicker/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-app that is a sort of calendar application and there are
I have a jQuery UI calendar widget that's displayed in my web application. I'd
In my web application I have taken a ajax calendar in that i want
I have an asp.net mvc 2.0 application that contains Areas/Modules like calendar, admin, etc...
I want to create a calendar in my application that external users can view.
I have an ASP.NET MVC application that is calendar-like. As per the NerdDinner example,
Mine is c# web application. I have a calendar control that defaults to today
I have a calendar feed (.ics) available from my application, but it's quite large
I am developing an application which requires to add Calendar event. I have written
In a WinForms (3.5) application there is form with a monthCalendar control. The calendar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.