5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 11   (RSS)

Hi, I am using the Zickey Calendar 5 and it is working well but can anyone tell me how I can put in a "Today" button, so when you click it it will take you to todays day, and how can I highlight todays date. Thank you in advance

Hi MercerDesign,

The calendar page by default shows the current month, so you can likely just link to the main calendar URL to get to "Today"

From what I can see there's no standard way to "highlight" a specific day, so you'll need to figure out how you want to change the CSS (style attribute, class, etc.). You can use the following in the calendar loop to check if it's listing today:

if ($cMonth == date('n') && $cYear == date('Y') && $date == date('j')) {
 // your code
}

This can the calendar loop below the line with "$day=$i-$startday+1;"

Let me know if that helps get this done, or if you have any questions!

Thanks,

Daniel
PHP Programmer
interactivetools.com

Hi, thank you for your help, however I am struggling to find where to put the code in my existing code:

<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
// To start the calendar on Monday instead of Sunday, switch out the next 2 lines
// $startday = $thismonth['wday'];
$startday = $thismonth['wday'] -1;
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) echo "<tr>\n";
if($i < $startday) {
echo "<td></td>\n";
}
else {
$day = $i - $startday + 1;
echo "<td class='CalDates'>". $day . "<br />";
// check if there are any events for this day
if (array_key_exists($day, $croscombe_eventsByDay)) {
// list all croscombe_events for this day
foreach ($croscombe_eventsByDay[$day] as $record) {
?> <div id="calFonts">
<h3><?php echo htmlencode($record['title']) ?></h3>
<p><strong><?php echo date("g:i a", strtotime($record['start_date'])) ?></strong></p>
<?php if($record['end_time'] != "0000-00-00 00:00:00") : ?>
<?php echo $record['end_time'] ?>
<?php endif; ?>

<p><?php echo htmlencode($record['location']) ?></p>
<hr>
<?php if($record['description'] != "") : ?>
<a href="/NEW-SITE-MERCER/croscombe<?php echo $record['_link'] ?>">Find out more >></a>
<?php endif; ?>
</div>
<?php
}
}
echo "</td>\n";
}
if(($i % 7) == 6 ) echo "</tr>\n";
}
?>

Perfect, it works now. THANK YOU