Skip to main content
added 85 characters in body
Source Link

It is working fine with Default permalink but not with custom structure permalink

calendar is made using following code

calendar is made using following code

It is working fine with Default permalink but not with custom structure permalink

calendar is made using following code

Source Link

Using calendar and page does not show calendar for next or previous year

I have created a page called mysite and have permalink as /XXX/wordpress/mysite ‎

On this page I am creating a calendar. The calendar is working little wierd. It is working for a current year but when on clicking next or previous button as soon as it switches to next or previous year calendar gets disappear and show following (default page not found) message "Well this is somewhat embarrassing, isn’t it?"

calendar is made using following code

CSS:

<style type="text/css"> .body { 
font-family: Verdana; 
background-color : #ACACAC;; 
} 

.tr { 
background-color : #ACACAC; 
} 

.th { 
font-family: Verdana; 
} 

a.buttonbar:link, a.buttonbar:visited { 
font-size        : 9px; 
padding-top      : 1px; 
padding-bottom   : 1px; 
text-decoration  : none; 
background-color : #ACACAC; 
color            : #FFFFFF 
} 
a.buttonbar:hover { 
padding-top      : 1px; 
padding-bottom   : 1px; 
background-color : #CCCCCC; 
color            : #FFFFFF 
} 
.normal { 
font-family: Verdana; 
font-size: 8pt; 
color: #000000; 
} 
.today { 
font-family: Verdana; 
font-size: 8pt; 
font-weight:bold; 
color:#000066; 
background-color: #CACACA; 
} 
.weekend { 
font-family: Verdana; 
font-size: 8pt; 
color:#FF0000; 
} 
.selected { 
font-family: Verdana; 
font-size: 8pt; 
color: #FFFFFF; 
background-color: #C00000; 
} 
.event { 
font-family: Verdana; 
font-size: 8pt; 
color: #000000; 
background-color: #C6D1DC; 
} 
.head { 
color:#CCCCCC; 
font:Arial, Helvetica, sans-serif; 
font-size:12px; 
font-weight:500; 
background-color:#000066; 
} 
.title { 
color:#000066; 
font:Arial, Helvetica, sans-serif; 
font-size:12px; 
font-weight:bold; 
} 
.button { 
font-family      : Verdana, Arial, Helvetica, sans-serif; 
font-style       : normal; 
font-weight      : bold; 
font-size        : 10px; 
color            : #000000; 
background-color : #F0F0F0; 
border           : 1px solid #000066; 
}
</style>

SCRIPT:

<script language="javascript"> 
function goLastMonth(month,year,form,field) 
{ 
    // If the month is January, decrement the year. 
    if(month == 1) 
{ 
--year; 
month = 13; 
}        
    document.location.href = 'http://localhost/wordpress/mysite/?month='+(month-1)+'&year='+year; 
} 

function goNextMonth(month,year,form,field) 
{ 
    // If the month is December, increment the year. 
    if(month == 12) 
{ 
++year; 
month = 0; 
}    
    document.location.href = 'http://localhost/wordpress/mysite/?month='+(month+1)+'&year='+year; 
} 

CODE:

<?php 
$day = $_GET["day"];
$month = $_GET["month"];
$year = $_GET["year"];
if ($day == "")
$day = date("j");

if ($month == "")
$month = date("m");

if ($year == "")
$year = date("Y");

$currentTimeStamp = strtotime("$year-$month-$day");
$monthName = date("F", $currentTimeStamp);
$numDays = date("t", $currentTimeStamp);
$counter = 0;
?>
<body style="margin:0px 0px 0px 0px" class="body"> 
<table width='175' border='0' cellspacing='0' cellpadding='0' class="body"> 
<tr> 
    <td width='25' colspan='1'> 
    <input type='button' class='button' value=' < ' onClick='<?php echo "goLastMonth($month,$year)"; ?>'> 
    </td> 
    <td width='125' align="center" colspan='5'> 
    <span class='title'><?php echo $monthName . " " . $year; ?></span><br> 
    </td> 
    <td width='25' colspan='1' align='right'> 
    <input type='button' class='button' value=' > ' onClick='<?php echo "goNextMonth($month,$year)"; ?>'> 
    </td> 
</tr> 
<tr> 
    <td class='head' align="center" width='25'>S</td> 
    <td class='head' align="center" width='25'>M</td> 
    <td class='head' align="center" width='25'>T</td> 
    <td class='head' align="center" width='25'>W</td> 
    <td class='head' align="center" width='25'>T</td> 
    <td class='head' align="center" width='25'>F</td> 
    <td class='head' align="center" width='25'>S</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> </td>"; 
    } 
    
    if($counter % 7 == 0) 
    echo "</tr><tr>"; 
    
    if(date("w", $timeStamp) == 0) 

    $class = "class='weekend'"; 
    else 
    if($i == date("d") && $month == date("m") && $year == date("Y")) 
    $class = "class='today'"; 
    else 
    $class = "class='normal'"; 
    
    //echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick=\"sendToForm('".sprintf("%02d/%02d/%04d", $month, $i, $year)."','$field','$form');\"><font $class>$i</font></a></td>"; 
    echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><a id='$i $month $year' class='buttonbar' target='_blank' onmouseover=display($i,$month,$year) \"><font $class>$i</font></a></td>";
} 
?> 
</tr> 
</table> 
</body>