Tutorials
Using tooltips
-
Using tooltips
Posted on October 6, 2003
Written by
Louise (view more by Louise)
Comments (0)
Filed under Scripts: PHPCalendar, Tutorials
Many people have asked me if they could use tooltips with PHPCalendar. Sure you can. Here’s how.
Okay, first of all, generate your tooltips code, and follow the instructions there. After you get this done, open calendar.php in your text/HTML editor.
On lines 62-71, you have this:
<td>
<a href="#" TITLE="<? $i=0; while ($i < $num) { $thing=mysql_result($result,$i,"thing"); if ($i == '0') { echo ""; } else { echo " and "; } ?>
<?=$thing?><? ++$i; } ?>">
<? echo "<b>"
.Date_Calc::daysToDate($month_cal[$row][$col],"%d")
."</b>\n";
?>
</a></td>
Change it to:
<td>
<a href="javascript:void(0)" onmouseover="EnterContent('ToolTip','<?php echo Date_Calc::dateFormat($day, $month, $year, '%B') . ' ' . $today_day; ?>', '<?php $i = 0; while($i < $num) { $thing = mysql_result($result, $i, 'thing'); if ($i != 0) { echo ' and '; } echo $thing; $i++; } ?>'); Activate();" onmouseout="deActivate()"><?php
echo Date_Calc::daysToDate($month_cal[$row][$col], '%d') . "\n"; ?></a>
</td>
And on lines 86-95, you’ll find this:
<td>
<a href="#" title="<? $i=0; while ($i < $num) { $thing=mysql_result($result,$i,"thing"); if ($i == '0') { echo ""; } else { echo " and "; } ?>
<?=$thing?><? ++$i; } ?>">
<? echo ""
.Date_Calc::daysToDate($month_cal[$row][$col],"%d")
."\n";
?>
</a></td>
Change it to:
<td>
<a href="javascript:void(0)" onmouseover="EnterContent('ToolTip','<?php echo Date_Calc::dateFormat($day, $month, $year, '%B') . ' ' . $monthday?>', '<?php $i = 0; while($i < $num) { $thing = mysql_result($result, $i, 'thing'); if ($i != 0) { echo ' and '; } echo $thing; $i++; } ?>'); Activate();" onmouseout="deActivate()"><?php echo Date_Calc::daysToDate($month_cal[$row][$col], '%d') ."\n"; ?></a>
</td>
That’s it for calendar.php. Now, the next two files…
On calendar_year.php and calendar_bdays.php, this is what you have on lines 80-87:
<td><a href="#" title="<? $i=0; while ($i < $num) { $thing=mysql_result($result,$i,"thing"); if ($i == '0') { echo ""; } else { echo " and "; } ?><?=$thing?>
<? ++$i;} ?>">
<? echo "<b>$day</b>\n"; ?>
</a></td>
Change it to:
<td>
<a href="javascript:void(0)" onmouseover="EnterContent('ToolTip', '<?php echo Date_Calc::getMonthFullname($curr_month + 1) . ' ' . $day; ?>', '<?php $i = 0; while($i < $num) { $thing = mysql_result($result, $i, 'thing'); if ($i != 0) echo ' and '; echo $thing; $i++; } ?>'); Activate();" onmouseout="deActivate()"><?php echo '<b>' . $day . "</b>\n"; ?></a>
</td>
And on lines 99-106, you have:
<td>
<a href="#" title="<? $i=0; while ($i < $num) { $thing=mysql_result($result,$i,"thing"); if ($i == '0') { echo ""; } else { echo " and "; } ?><?=$thing?>
<? ++$i; } ?>">
<? echo "$dayn"; ?>
</a></td>
Change it to:
<td>
<a href="javascript:void(0)" onmouseover="EnterContent('ToolTip', '<?php echo Date_Calc::getMonthFullname($curr_month + 1) . ' ' . $day; ?>', '<?php $i = 0; while($i < $num) { $thing = mysql_result($result, $i, 'thing'); if ($i != 0) echo ' and '; echo $thing; $i++; } ?>'); Activate();" onmouseout="deActivate()"><?php echo $day; ?></a>
</td>
That’s it!
Comments
Comments are closed for this entry.