TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 400
  • Total: 400

SMF Calendar Block

Started by Lesmond, September 03, 2005, 11:30:42 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Gargoyle

Quote from: londonhogfan on August 07, 2006, 04:40:26 PM
If you go into the code and make the <table width="100%"

it will go all the way from side to side.  One of the SSI codes eventsToday isnt usually long enough to make it go 100%.  I think thats what  is causing all the problems.

I combined a couple and and removed the "post" part of the links from the calendar dates so it wouldnt take everyone to a login screen (because I don't allow most people to post calendar events).  I like the results.  Here is what I'm using.


global $scripturl, $modSettings, $sourcedir;

$now = mktime() + $modSettings['time_offset'] * 3600;
         $today = date('j',$now);
         $year = date("Y",$now);
         $month = date("n",$now);
         $days = array($today=>array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; border: solid 1px black; background-color: white; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>'));

         $day_name_length = 2;
         $month_href = $scripturl . '?action=calendar';
         $first_day = 0;
         $pn = array();

$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table align="center" valign="top" width="100%">'."\n".
'<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday   = 0; #start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td "'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else
{
$calendar .= "<td class=\"smalltext\" style=\"padding-right:4px;\"><a";
if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$day</a></td>";
}
}
if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days

echo $calendar.'</tr>';

#create notice for Holidays, Events & Birthdays.

if (ssi_todaysHolidays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #000000;"><b>Holiday Today</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysHolidays();
  echo '</span></td></tr>';
}


if (ssi_todaysEvents('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #000000;"><b>Special Events Today</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysEvents();
  echo '</span></td></tr>';
}

if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #000000;"><b>Birthdays Today</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysBirthdays();
  echo '</span></td></tr>';
}
echo '</table>';


Great code but the events thing was getting me so I removed the  "today" text and I removed the "style color" command... Works awesome now!! Very good work and thanks to all that contributed to this code! I'll paste what I am using below.

global $scripturl, $modSettings, $sourcedir;

$now = mktime() + $modSettings['time_offset'] * 3600;
         $today = date('j',$now);
         $year = date("Y",$now);
         $month = date("n",$now);
         $days = array($today=>array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; border: solid 1px black; background-color: white; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>'));

         $day_name_length = 2;
         $month_href = $scripturl . '?action=calendar';
         $first_day = 0;
         $pn = array();

$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table align="center" valign="top" width="100%">'."\n".
'<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday   = 0; #start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td "'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else
{
$calendar .= "<td class=\"smalltext\" style=\"padding-right:4px;\"><a";
if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$day</a></td>";
}
}
if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days

echo $calendar.'</tr>';

#create notice for Holidays, Events & Birthdays.

if (ssi_todaysHolidays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center"><b>Holidays</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysHolidays();
  echo '</span></td></tr>';
}


if (ssi_todaysEvents('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center"><b>Special Events</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysEvents();
  echo '</span></td></tr>';
}

if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center"><b>Birthdays</b></td><td><hr></td></tr><td colspan="7" class="windowbg" ><span class="smalltext">';
  ssi_todaysBirthdays();
  echo '</span></td></tr>';
}
echo '</table>';

itsacoaster

Quote from: jpark on August 20, 2006, 09:34:01 PM
oops, what am i talking about?  i think the version i'm using now does in fact show the date.  Try this: global $scripturl, $modSettings;

         $now = mktime() + $modSettings['time_offset'] * 3600;
         $today = date('j',$now);
         $days = array($today=>array(NULL,NULL,'<span class="smalltext" style="color: blue; font-weight: bold; border: solid 0px black; background-color: #ffffff; padding: 0px 4px 0px 4px;">'.$today.'</span>'));
         $year = date("Y",$now);
         $month = date("n",$now);

         $day_name_length = 2;
         $month_href = $scripturl . '?action=calendar';
         $first_day = 0;
         $pn = array();

$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table align="center" valign="top">'."\n".
'<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
            $calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday   = 0; #start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else
{
$calendar .= "<td style=\"padding-right: 4px; font-size: x-small; font-family: trebuchet ms, verdana, sans-serif;\"  onmouseover=\"this.style.backgroundColor='#D0E4FF'\" onMouseOut=\"this.style.backgroundColor=''\"><a";
if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;sa=post;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$day</a></td>";
}
} if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
echo $calendar.'</tr>';

#create notice for Holidays, Events & Birthdays.

if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_bdaycolor'] . ';"><u><b>BIRTHDAYS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysBirthdays();
  echo '</td></tr>';
}

if (ssi_todaysHolidays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_holidaycolor'] . ';"><u><b>SPECIAL DAYS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysHolidays();
  echo '</td></tr>';
}

if (ssi_todaysEvents('')) {
$result = ssi_todaysCalendar('');
if(!empty($result['events']))
{
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_eventcolor'] . ';"><u><b>EVENTS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
$events = $result['events'];
foreach ($events as $event)
{
echo '
'.substr($event['start_date'],5 , 2).'/'.substr($event['start_date'],8).':';
if ($event['can_edit'])
echo '
<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
echo '
' . $event['link'] . '<br />';
}
                   }
  echo '</td></tr>';
}

echo '</table>';


I think either i found it or was able to combine codes... either way, see if it works for you~!
Umm... wow, that is fantastic!  Thank you so much!

rafynet

I've been playing around with the existing code for the calendar block and here are my results so far.
:D

  • incorporated a flash countdown swf that count's down to current user's birthday
  • Birthdays, Events and Holidays are now showing dates
  • <<< Previous and Next >>> month jump is working
  • color coded day highlighting for bdays, evants and holidays
  • mouseover 'tooltip' showing what is happening on that day *using a DynamicDrive tooltip javascript

Comments are welcome please.

akulion

excellent :D now how about sharin n a live preview

RoarinRow

Quote from: akulion on September 01, 2006, 05:50:29 AM
excellent :D now how about sharin n a live preview

and the code would be helpful too   :up:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

G6Cad

Yes, the code for that would be nice to have to ;)

grabman

yeah, very cool!~!  is there live preview anywhere?  or code maybe??

akulion

his website is a private special members only site thats why no prview

but it would be really cool if you could share the code with us :)

rafynet

#178
ya .. sorry .. my site is private ..
you can look at the block in action now though .. as i made it available to guests ...
you will not see any events as you don't have the access to see them but this preview seems to be working ok .... it's just using current date to count down to ...



http://www.rafy.net

Instructions to install:
1. unzip attached rcount.zip to /somewhere/on/yoursite/rcount.swf.
2. paste this code to a PHP block.
3. where it says /<change.this>/rcount.swf in 2 places in this code ... put /somewhere/on/yoursite/rcount.swf where you saved rcount.swf
4.  ;) good luck.



global $user_settings;

if($user_settings['birthdate'] == '0001-01-01')
{
?><div align="center" style="color:red; font-size:medium;">YouR birTHDate is <strong>NOT SET</strong> !!! set YOUr biRThdate <a href="http://www.rafy.net/index.php?action=profile;sa=forumProfile"> HERE </a> to C Da CounTDown !</div><?
return;
}

$birthdate = strtotime($user_settings['birthdate']);
$nextbirthdate = date("U",strtotime(date("Y") .'-'. date("m", $birthdate) .'-'. date("d", $birthdate)));
$today = time();

if($nextbirthdate < $today){
$nextbirthdate = date("U",strtotime(date("Y")+1 .'-'. date("m", $birthdate) .'-'. date("d", $birthdate)));
}

//echo date("Y-m-d", $today) . '<br>';
//echo date("Y-m-d", $nextbirthdate) . '<br>';

?>
<div align="center" style="color:#7C5401"><strong>tiME lEFt 2 Ur BirThDay</strong></div>
<div align="center" style="font-size:large;"><? echo date("F jS", $nextbirthdate)?></div>
<div align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="165" height="30" id="rcount" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/<change.this>/rcount.swf?r_year=<? echo date("Y",$nextbirthdate);?>&r_month=<? echo date("m",$nextbirthdate);?>&r_day=<? echo date("d",$nextbirthdate);?>&r_hour=00&r_minute=00" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#f6cf59" /><embed src="/<change.this>/rcount.swf?r_year=<? echo date("Y",$nextbirthdate);?>&r_month=<? echo date("m",$nextbirthdate);?>&r_day=<? echo date("d",$nextbirthdate);?>&r_hour=00&r_minute=00" quality="high" wmode="transparent" bgcolor="#f6cf59" width="165" height="30" name="rcount" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>

<hr style="border: 1px solid #7C5401" />

<?php 

global $scripturl$modSettings$sdays;

$now mktime() + $modSettings['time_offset'] * 3600;
$today date('j',$now);
$year date("Y",$now);
if (isset(
$_REQUEST['month'])) {
$month $_REQUEST['month'];
} else {
$month date("n",$now);
}

#create notice for Holidays, Events & Birthdays.

if (ssi_rafy_todaysBirthdays('')) {
echo '<div align="center" class="smalltext" style="font-weight: bold; color: #' $modSettings['cal_bdaycolor'] . ';">Birthdayz</div>';
echo '<span class="smalltext">';
$birthdays split(','ssi_rafy_todaysBirthdays('echo'$month));
echo '</span>';

echo '<hr style="border: 1px solid #7C5401" />';
}

if (
ssi_rafy_todaysEvents('')) {
echo '<div align="center" class="smalltext" style="font-weight: bold; color: #' $modSettings['cal_eventcolor'] . ';">Special Eventz</div>';
echo '<span class="smalltext">';
$events split(','ssi_rafy_todaysEvents('echo'$month));
echo '</span>';

echo '<hr style="border: 1px solid #7C5401" />';
}

if (
ssi_rafy_todaysHolidays('')) {
echo '<div align="center" class="smalltext" style="font-weight: bold; color: #' $modSettings['cal_holidaycolor'] . ';">Holidayz</div>';
echo '<span class="smalltext">';
$holidays split(','ssi_rafy_todaysHolidays('echo'$month));
echo '</span>';

echo '<hr style="border: 1px solid #7C5401" />';
}


//list($eventday, $eventlink) = each($events);
//echo '<hr>';
//foreach($holidays as $ed){
// $event = split('=>', $ed);
// echo $event[0].$event[1];
//}
//echo '<hr>';

$days = array($today=>array(''.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'',NULL,'<span style="font-weight: bold; border: solid 1px white; padding: 0px 0px 0px 0px;">'.$today.'</span>'));

$day_name_length 3;
$month_href $scripturl '?action=calendar&month=' $month;
$first_day 0;
$pn = array('ÂÃ,«Ã‚Ã,«Ã‚Ã,«'=>$scripturl.'?month='.($month-1), 'ÂÃ,»Ã‚Ã,»Ã‚Ã,»'=>$scripturl.'?month='.($month+'1'));

$first_of_month gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400$n<7$n++,$t+=86400#January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month$year$month_name$weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday $first_day) % 7#adjust for $first_day
$title   htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p$pl) = each($pn); @list($n$nl) = each($pn); #previous and next links, if applicable
if($p$p '<span class="smalltext">'.($pl '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' $p).'</span>   ';
if($n$n '   <span class="smalltext">'.($nl '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' $n).'</span>';

$calendar '<table>'."\n".
'<caption >'.$p.($month_href '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length substr($d,0,$day_name_length) : $d).'</th>';
            
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday 0$calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'#initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month$day++,$weekday++){
$sp1 '';
$sp2 '';
foreach($holidays as $sd) {
$event split('=>'$sd);
if($day == intval($event[0]))
{
$sp1 '<span align="right" style="color: #FFFFFF; background-color: #' $modSettings['cal_holidaycolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
$sp2 '</span>';
}
}
foreach($events as $sd) {
$event split('=>'$sd);
if($day == intval($event[0]))
{
$sp1 '<span align="right" style="color: #FFFFFF; background-color: #' $modSettings['cal_eventcolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
$sp2 '</span>';
}
}
foreach($birthdays as $sd) {
$event split('=>'$sd);
if($day == intval($sd))
{
$sp1 '<span align="right" style="color: #FFFFFF; background-color: #' $modSettings['cal_bdaycolor'] . '; padding: 0px 0px 0px 0px;" title="'.htmlspecialchars($event[1]).'">';
$sp2 '</span>';
}
}
if($weekday == 7){
$weekday   0#start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day]) and ($month == date("n",$now))){
@list($link$classes$content) = $days[$day];
if(is_null($content))  $content  $day;
$calendar .= '<td'.($classes ' class="'.htmlspecialchars($classes).'">' '>');
$calendar .= ($link '<a href="'.htmlspecialchars($link).'">'.$sp1.$content.$sp2.'</a>' $sp1.$content.$sp2).'</td>';
}
else 
{
$calendar .= "<td style=\"padding-right: 0px; font-size: xx-small; font-family: verdana, sans-serif;\"><a";
if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;sa=post;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$sp1$day$sp2</a></td>";
}
}
if(
$weekday != 7$calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'#remaining "empty" days
echo $calendar.'</tr>';
echo 
'</table>';

// Show today's birthdays.
function ssi_rafy_todaysBirthdays($output_method 'echo'$month)
{
global $context$scripturl$db_prefix;

if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
return array();

if ($output_method != 'echo')
return $context['calendar_birthdays'];

foreach ($context['calendar_birthdays'] as $member)
{
$query db_query(
"SELECT birthdate
FROM 
{$db_prefix}members 
WHERE ID_MEMBER='"
.$member['id']."'"__FILE____LINE__);

$row mysql_fetch_assoc($query);
$birthdate strtotime($row['birthdate']); 

echo '<div align="center">';
echo '<a href="'$scripturl'?action=calendar;year=' date("Y") . ';month=' date("n",$birthdate) . '"><strong>' date("F jS",$birthdate) . '</strong></a>';
echo '<br />';
echo '<img src="/Themes/rOrb/images/icons/birthday_small.gif" width="13" height="17" align="absmiddle" hspace="5">';
echo '<a href="'$scripturl'?action=profile;u='$member['id'], '">';
echo $member['name'] . (isset($member['age']) ? ' (' $member['age'] . ')' '');
echo '</a>';
// echo (!$member['is_last'] ? '<br>' : '');

echo '</div>';

if(date("n",$birthdate) == $month)
{
$sdays .= date("j",$birthdate).'=>'.$member['name'].'ÂÃ,´s bDay'.',';
}
}
return $sdays;
}

// Show today's events.
function ssi_rafy_todaysEvents($output_method 'echo'$month)
{
global $context$db_prefix;

if (!smf_loadCalendarInfo() || empty($context['calendar_events']))
return array();

if ($output_method != 'echo')
return $context['calendar_events'];

foreach ($context['calendar_events'] as $event)
{
$query db_query(
"SELECT startDate
FROM 
{$db_prefix}calendar 
WHERE ID_EVENT='"
.$event['id']."'"__FILE____LINE__);

$row mysql_fetch_assoc($query);
$startDate strtotime($row['startDate']); 

echo '<div align="center">';
echo '<a href="'$scripturl'?action=calendar;year=' date("Y") . ';month=' date("n",$startDate) . '"><strong>' date("F jS Y",$startDate) . '</strong></a>';
echo '<br />';

if ($event['can_edit'])
echo '<a href="' $event['modify_href'] . '" style="color: #FF0000;">[e]</a> ';
echo $event['link'] ;
// echo (!$event['is_last'] ? '<br>' : '');
echo '</div>';

if(date("n",$startDate) == $month)
{
$sdays .= date("j",$startDate).'=>'.str_replace("'","ÂÃ,´",$event['link']).',';
}
}
return $sdays;
}

// Show today's holidays.
function ssi_rafy_todaysHolidays($output_method 'echo'$month)
{
global $context;

if (!smf_loadCalendarInfo() || empty($context['calendar_holidays']))
return array();

if ($output_method != 'echo')
return $context['calendar_holidays'];


foreach($context['calendar_holidays'] as $holiday) {
$query db_query(
"SELECT eventDate
FROM 
{$db_prefix}smf_calendar_holidays 
WHERE title='"
.str_replace("'","''",$holiday)."' 
AND (eventDate LIKE '"
.date("Y")."%' OR eventDate LIKE '0004%')"__FILE____LINE__);

$row mysql_fetch_assoc($query);
$eventDate strtotime($row['eventDate']); 

echo '<div align="center">';
echo '<a href="'$scripturl'?action=calendar;year=' date("Y") . ';month=' date("n",$eventDate) . '"><strong>' date("F jS",$eventDate) . '</strong></a>';
echo '<br />';
echo $holiday;
echo '</div>';

if(date("n",$eventDate) == $month)
{
$sdays .= date("j",$eventDate).'=>'.str_replace("'","ÂÃ,´",$holiday).',';
}
}
return $sdays;
}


Svaha

I like this calendar, at the moment I'm testing a conversion from my xoops 2.2.4 / cbb 3.04 forum and just waiting for the new release of tp.
I wonder if someone could ad a random display of pictures in the head of the calendar like this you can see on my site (on the left)
http://www.alohaspirit.nl/modules/myhome/index.php

This website is proudly hosted on Crocweb Cloud Website Hosting.