|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to colour in weekend?
Can some kind soul point me in the direction of how to colour the weekend cells so they stand out from the weekdays? I've managed to colour the empty cells (i.e. cells without a date in them) without much ado but the weekends have thrown me.
|
|
#2
|
|||
|
|||
|
RE: How to colour in weekend?
I'd do something like this......
In ltwdisplaymonth.php: 1) add two class vars var $sat_dow = 6; var $sun_dow = 0; 2) modify the constructor(~line 69) Old ======================================= if ( $this->week_starts_monday == 1 ){ $this->first_day_of_month = $this->first_day_of_month-1; if ( $this->first_day_of_month < 0 ) $this->first_day_of_month = 6; } New ======================================= if ( $this->week_starts_monday == 1 ){ $this->first_day_of_month = $this->first_day_of_month-1; if ( $this->first_day_of_month < 0 ) $this->first_day_of_month = 6; $this->sat_dow = 5; // NEW LINE $this->sun_dow = 6; // NEW LINE } 3) Modify the <td> code (~line 191) Old (1 line only) ======================================= echo "<td class="cal" width="14%" height="" . (100 / $num_of_rows) . "%">"; New (7 lines total) ======================================= echo "<td class="cal" width="14%" height="" . (100 / $num_of_rows) . "%" "; if ( ($j = $this->sat_dow) || ($j = $this->sun_dow) ){ // weekend color echo " bgcolor="0x000000" "; }else{ // weekday color echo " bgcolor="0xFFFFFF" "; } echo " >"; I'd probably make the different colors config params so you don't have to change code to modify them. !!Disclaimer!! I have not tested this code on a working system, so the syntax may not be 100% correct. But it should be close enough to get you going. |
|
#3
|
|||
|
|||
|
RE: How to colour in weekend?
i copied the td.cal in ltw_style.css to td.cal_sunson and changed the background-color. the modified code at ltwdisplaymonth.php looks now like this:
echo "<td width="14%" height="" . (100 / $num_of_rows) . "%" "; if ( ($j == $this->sat_dow) || ($j == $this->sun_dow) ){ // weekend color echo " class="cal_sunson" "; }else{ // weekday color echo " class="cal" "; } echo " >"; |
![]() |
| Viewing: Codewalkers Forums > Projects > ltwCalendar > How to colour in weekend? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|