Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/19/2019 in all areas

  1. you would initially create an array of the dates (Y-m-d date format) you want to highlight and store this array in a class property. at the point in the code where it is producing the css class selector and the cell content, you would use in_array() to find if $this->currentDate is one of the dates in the array. note: the author of that script should have produced a $today value in the Y-m-d format and just directly compared it with $this->currentDate in the existing css class selector code.
    1 point
  2. If you had php error checking turned on (as one should during ALL DEVELOPMENT) you would have probably been told of an error. In your first attempt you had a 'NON null' phrase on one field when you probably meant to use 'NOT null'.
    1 point
  3. the code in the _showDay() method is for producing a single cell. you would not add any loop to it. see the following logic for the end of the _showDay() method - // hard way of testing if the day being displayed is today $today_day = date("d"); $today_mon = date("m"); $today_yea = date("Y"); $class_day = ($cellContent == $today_day && $this->currentMonth == $today_mon && $this->currentYear == $today_yea ? "calendar_today" : "calendar_days"); // easy way of testing if the day being displayed is today $today = date('Y-m-d'); $class_day = $this->currentDate == $today ? "calendar_today" : "calendar_days"; // the above logic sets the $class_day to highlight 'today' and $cellContent if the day number should be displayed (currentDate is between the start and end of the month) // to add highlighting or different cellContent do that here if(in_array($this->currentDate, $this->highlight_dates)) { $class_day = "calendar_today"; // uses the existing 'today' css. change as needed $cellContent = ""; // produce the desired content (link) as needed } return '<div class="' . $class_day . '">' . $cellContent . '</div>' . "\r\n"; you would define a class property highlight_dates or a name of your choice as an empty array. if the array is left empty, the code works as is. you would then just assign an array of dates to the hightlight_dates property to cause the additional logic to do its thing. while you can make this array of values just the day number, here are some reasons to use a full date - you may have an array of holidays or company days off for the entire year or these dates may be event dates. you can just put these values into the array and the code will work. so, for your example of birthdays, you would just need to use the current year in the birth date values to come up with the full date values.
    0 points
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.