Welcome Guest, Not a member yet? Register   Sign In
Adding multiple variables to calendar days
#11

(This post was last modified: 08-04-2017, 06:38 AM by Wouter60.)

Start with adding a placeholder for the css class in the template you want to use:
Code:
'cal_cell_start'    => '<td {css_class}>'

In the generate function (in MY_Calendar.php), look up this line:
PHP Code:
$out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->replacements['cal_cell_start_today'] : $this->replacements['cal_cell_start']; 

Replace it with this:
PHP Code:
$csstmp = isset($css[$day]) ? 'class="' $css[$day] . '"' NULL;
$cstoday str_replace('{css_class}'$csstmp,$this->replacements['cal_cell_start_today']);
$cs str_replace('{css_class}',$csstmp,$this->replacements['cal_cell_start']);
$out .= ($is_current_month === TRUE && $day == $cur_day) ? $cstoday $cs

The result is that the placeholder {css_class} is replaced with the given class for that day, or with NULL if no class was given for that day.
Reply


Messages In This Thread
RE: Adding multiple variables to calendar days - by Wouter60 - 08-04-2017, 05:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB