Shared Files Search Engine File Search Engine

Search Artikel

Minggu, 29 April 2012

Script PHP - Kalender


Disini saya bakal bagi'in scrip untuk kalender. Nah kalender ini bisa kalian sisipin deh nanti di project dreamweaver kalian, biar tambah bagus web nya.. ^,^
 <?
//alviskejengkang.blogspot.com
//////////////////////////////////////////
//////////BEGIN CALENDAR CODE ////////////
//////////////////////////////////////////

// CALENDAR MARKING STYLE
// Setting '$calstyle' to 1 will mark calendar dates using table background colors
// [Style 1 is default in any version before 2.0]
// Setting this to 2 will mark calendar dates using graphics for background colors
// If using Style 2, all 'stat' graphics should be in the same directory as this script
// You can edit the 'stat' graphics to meet your needs
if (!$calstyle) $calstyle = "1";

// CELL BACKGROUND COLORS
// Edit these colors to suit your needs [for Calendar Style 1]
$nbc="EEEEEE"; // NORMAL BACKGROUND COLOR
$abc="E9B4A1"; // MARKED BACKGROUND COLOR
$tbc="CCFFCC"; // TODAY'S BACKGROUND COLOR

// DAY NAMES
// Edit the calendar day name column headers below
$day[0]="Su";
$day[1]="Mo";
$day[2]="Tu";
$day[3]="We";
$day[4]="Th";
$day[5]="Fr";
$day[6]="Sa";

// MONTH NAMES
// Edit the calendar month names below
$mth[1]="January";
$mth[2]="February";
$mth[3]="March";
$mth[4]="April";
$mth[5]="May";
$mth[6]="June";
$mth[7]="July";
$mth[8]="August";
$mth[9]="September";
$mth[10]="October";
$mth[11]="November";
$mth[12]="December";

// ON WHAT DAY DOES THE WEEK START?
// 0=Sunday; 1=Monday; 2=Tuesday; 3=Wednesday; 4=Thursday; 5=Friday; 6=Saturday
// This option can be set here or overridden by the command-line option 'daystart='
if (!$daystart) $daystart=0;

// PRINT YEAR?
// Changing 0 to 1 will not display the year number after the month name
// This option can be set here or overridden by the command-line option 'ny='
if (!$ny) $ny=0;

// MARK TODAY?
// Changing 0 to 1 will not mark today's date
// This option can be set here or overridden by the command-line option 'nt='
if (!$nt) $nt=0;

// HOURS TO OFFSET TIME +/-
// To add hours, enter a positive value. To substract hours, enter a "-" negative value
// This option can be set here or overridden by the command-line option 'ctime='
if (!$ctime) $ctime = "-0";

// CALENDAR WIDTH AND HEIGHT
// Set $tw to the width of the calendar table
// Set $ch to the height of the table cells for dates
// These options can be set here or overridden by the command-line options 'tw=' and 'ch='
if (!$tw) $tw="175"; // Table Width
if (!$ch) $ch="0";   // Cell Height

// DATE NUMBER ALIGNMENT
// Set $algn to 0 [defult] to align the dates to the middle and center of table cells.
// Set $algn to 1 to align the dates to the upper-right corner of table cells.
// This option can be set here or overridden by the command-line option 'algn='
if (!$algn) $algn="0";

// FONT SIZES AND WEIGHT
// These options can be set in the script or overridden by command-line options of
// the same named variables. The sizes are in pixels.

if (!$fsm) $fsm="18"; // FONT SIZE MONTH
if (!$fsd) $fsd="9";  // FONT SIZE DAY NAMES
if (!$fsn) $fsn="11"; // FONT SIZE NUMBERS

if (!$fwm) $fwm="bold"; else $fwm="normal"; // FONT WEIGHT MONTH
if (!$fwd) $fwd="normal"; else $fwd="bold"; // FONT WEIGHT DAY NAMES
if (!$fwn) $fwn="normal"; else $fwn="bold"; // FONT WEIGHT NUMBERS

// ONLY EDIT THE STYLE SHEET BELOW IF YOU WANT TO CHANGE THE FONT FACE AND/OR COLOR

?>
<style TYPE="text/css">
<!--
.monthyear {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: <?echo$fsm?>px; font-weight: <?echo$fwm?>; color: #000000}
.daynames {  font-family: Arial, Helvetica, sans-serif; font-size: <?echo$fsd?>px; font-weight: <?echo$fwd?>; color: #000000}
.dates {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: <?echo$fsn?>px; font-weight: <?echo$fwn?>; color: #000000}
-->
</style>
<?

////////////////////////////////////////
///// DO NOT EDIT BELOW THIS POINT /////
////////////////////////////////////////

// CALCULATE COLUMN WIDTHS
$cw=$tw/7;

// DETERMINE AND SET DATE NUMBER CELL ALIGNMENT
if ($algn==0) $algn="align='center' valign='middle'";
else $algn="align='right' valign='top'";

// DETERMINE TODAYS DAY NUMBER
$ctime = $ctime*3600;
$tmo = date("m", time()+$ctime);
$tda = date("j", time()+$ctime);
$tyr = date("Y", time()+$ctime);
$tnum = (intval((date ("U", mktime(20,0,0,$tmo,$tda,$tyr))/86400)))-$daystart; // TODAY'S DAY NUMBER

// CHECK FOR COMMAND LINE DATE VARIABLES
if (!$mo) $mo=$tmo;
if (!$yr) $yr=$tyr;

$daycount = (intval((date ("U", mktime(20,0,0,$mo,1,$yr))/86400)))-$daystart; // FIRST OF MONTH DAY NUMBER

$mo=intval($mo);
$mn = $mth[$mo]; // SET MONTH NAME
if ($ny!=1) {$mn = $mn." ".$yr;} // ADD YEAR TO MONTH NAME?

// ON WHAT DAY DOES THE FIRST FALL
$sd = date ("w", mktime(0,0,0,$mo,1-$daystart,$yr));
$cd = 1-$sd;

// NUMBER OF DAYS IN MONTH
$nd = mktime (0,0,0,$mo+1,0,$yr);
$nd = (strftime ("%d",$nd))+1;

////////////////////////////////////////
// PROCESS DAY MARKING /////////////////
////////////////////////////////////////

if ($mrks) {

$mrks = explode ("x",$mrks);
$smc = count ($mrks);
$mrke = explode ("x",$mrke);
$emc = count ($mrke);

if ($smc==1) {
$mrks[1]="3000-01-01";
$mrke[1]="3000-01-01";
}
}

$i=0;

while ($i < $smc) {

$mrks[$i] = ereg_replace('-','/', $mrks[$i]);
$mrke[$i] = ereg_replace('-','/', $mrke[$i]);
$start = intval(strtotime ($mrks[$i])/86400)+1;
$end = intval(strtotime ($mrke[$i])/86400)+1;

if (!$mrke[$i]) $end=$start; // MARK SINGLE DAY WITH ONLY MRKS VARIABLE

if (!$bgc[$start]) {$bgc[$start]=1;} else {$bgc[$start]=4;}
$bgc[$end]=3;
for ($n = ($start+1); $n < $end; $n++) {
$bgc[$n] = 2;}
$i++;
}

////////////////////////////////////////////
// DISPLAY CALENDAR ////////////////////////
////////////////////////////////////////////

?>
<table WIDTH="<?echo$tw?>" BORDER="0" CELLSPACING="0" CELLPADDING="2">
  <tr>
    <td CLASS="monthyear">
      <div ALIGN="center">
        <?echo "$mn";?>
      </div>
    </td>
  </tr>
</table>
    
<table WIDTH="<?echo$tw?>" BORDER="0" CELLSPACING="2" CELLPADDING="1" CLASS="daynames">
  <tr ALIGN="center">
<?
for ($I=0;$I<7;$I++) {
$dayprint=$daystart+$I;
if ($dayprint>6) $dayprint=$dayprint-7;
echo"<td WIDTH=$cw>$day[$dayprint]</td>";
}
?>
  </tr>
<?
// PRINT CALENDAR USING TABLE BACKGROUND COLORS [CALENDAR STYLE 1]
if ($calstyle==1) {
for ($i = 1; $i<7; $i++) {
if ($cd>$nd) break;
?>
<tr <?echo$algn?> CLASS="dates" height=<?echo$ch?>>
<?
for ($prow = 1; $prow<8; $prow++) {
if ($daycount==$tnum && $nt!="1" && $cd>0) {echo "<td width=$cw bgcolor=$tbc>$cd</td>";$daycount++;$cd++;}
else { ?>
<td width="<?echo$cw?>"<?if ($cd>0 && $cd<$nd) {echo " bgcolor=";if ($bgc[$daycount]) {echo $abc;} else {echo $nbc;} echo ">$cd";$daycount++;} else {echo ">";} $cd++;?></td>
<? }} ?>
</tr>
<?
}
} // END [CALENDAR STYLE 1]

// PRINT CALENDAR USING GRAPHICS BACKGROUNDS [CALENDAR STYLE 2]
if ($calstyle==2) {
for ($i = 1; $i<7; $i++) {
if ($cd>$nd) break;
?>
<tr <?echo$algn?> CLASS="dates" height=<?echo$ch?>>
<?
for ($prow = 1; $prow<8; $prow++) {
if ($daycount==$tnum && $nt!="1" && $cd>0) {echo "<td width=\"25\" background='stath$bgc[$daycount].gif'>$cd</td>";$daycount++;$cd++;}
else { ?>
<td width="25"<?if ($cd>0 && $cd<$nd) {echo " background='stat$bgc[$daycount].gif'>$cd";$daycount++;} else {echo ">";} $cd++;?></td>
<? }} ?>
</tr>
<?
}
} // END [CALENDAR STYLE 2]

?>

</table>
Nah ini screenshot nya :


Untuk lebih lengkapnya, download aja langsung scriptnya beserta icon gambarnya disini

Related Posts by Categories

0 komentar:

Posting Komentar

Tinggalkan komentar anda... Komentar anda sangat membantu untuk kemajuan blog ini..