|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hightlight Current Day
How would i get it to highlight the current day? Nice calendar btw.
|
|
#2
|
|||
|
|||
|
RE: Hightlight Current Day
I was able to "sort of" take care of this; by adding a class to the stylesheet called "td.curday"
defined the background color in there... Then I added the following code to line 245 of ltwdisplaymonth $thisday = $date("j,l,Y"); (just below function displayMonth() ) Then I added the following to the section on ltwdisplaymonth that defines the TD (which is somewhere around line 389 in my editor: echo "<td class="curday" width="14%" height="" . (100 / $num_of_rows) . "%">"; $this->_popup_link("day",$this->php_self."?display=day&stamp=".$this->stamp."&day=".$day."&returnto=month",$day); echo "<br>"; } else { echo "<td class="cal" width="14%" height="" . (100 / $num_of_rows) . "%">"; $this->_popup_link("day",$this->php_self."?display=day&stamp=".$this->stamp."&day=".$day."&returnto=month",$day); echo "<br>"; } (that's more of an edit actually) However, the only problem I'm working on ironing out is WHY it's now highlighting not only TODAYS date, but every "12th" of EVERY month. |
|
#3
|
|||||
|
|||||
|
RE: Hightlight Current Day
I changed your code to highlight only the current day. First I created the style as you did, and called it td.cal-today. Then I changed to the following lines in displayMonth():
php Code:
I re-ordered the $today calculation to make it easier to compare against today, and inserted a variable into the class statement. Richard |
|
#4
|
|||
|
|||
|
RE: Hightlight Current Day
Quote:
Thought that I would lift the veil of anonymity and claim that I wrote the above. Richard |
|
#5
|
|||
|
|||
|
RE: Hightlight Current Day
Thanks a bunch. I'll throw that in and see how it works
|
|
#6
|
|||
|
|||
|
RE: Hightlight Current Day
Ok, I am able to get the day to show in lightblue. If I change the css "table.cal" to yellow the whole thing goes yellow. If I take out the "table.cal-today" it doesn't work.
I don't mind having the highlight being lightblue, but the day shows in the center. I can't seem to get it to work. Please HELP ! here is what I added to the css file table.cal-today { background-color: lightblue;^M height: 600px;^M border-style: none;^M border-width: 3px;^M font-family: sans-serif^M } Thanks, Matt |
|
#7
|
||||
|
||||
|
RE: Hightlight Current Day
Take a look at the default definition:
Quote:
Looks like you're missing the text-align and vertical-align settings. Also, you're using table.cal-today instead of td.cal-today. You want to modify the column, not the entire table... I think it should be like this: Quote:
|
|
#8
|
|||
|
|||
|
RE: Hightlight Current Day
Thanks that worked.
-Matt |
|
#9
|
|||
|
|||
|
RE: Hightlight Current Day
Hi,
I've tried to modify the displaymonth and I keep getting a parse error. I was wondering if you could help me figure out what I've done wrong. The main problem I can't figure out is where to add the code you guys posted here. On my display month the " $today = date('Y-m-d',str..." is not part of the "echo "<td class="cal" wi..." I've tried different variations, i.e., adding all the code to one area, breaking it up, and just using part of it, but I still get the parse/fatal error. Any suggestions? |
|
#10
|
|||
|
|||
|
RE: Hightlight Current Day
Here's where the code should go (this is in my version 4.1.3 code):
echo "<tbody>n"; for ( $i = 1; $i <= $num_of_rows; $i++ ){ echo "<tr>n"; for ( $j = 0; $j < 7; $j++ ){ if ( (($i == 1) && ($this->first_day_of_month <= $j)) || (($i > 1) && ($day <= $this->days_in_month)) ){ // date to store in DB is CREATED like this $today = date('Y-m-d',strtotime($this->year . "-" . $this->month . "-" . $day)); $todayTS = strtotime($today); if ($today == date("Y-m-d")) { $cal="cal-today"; } else { $cal="cal"; } echo "<td class="$cal" width="14%" height="" . (100 / $num_of_rows) . "%">"; $this->_popup_link("day",$this->php_self."?display=day&stamp=".$this->stamp."&day=".$day."&returnto=month",$day); echo "<br>"; |
|
#11
|
|||
|
|||
|
RE: Hightlight Current Day
Here's where the code should go (this is in my version 4.1.3 code):
echo "<tbody>n"; for ( $i = 1; $i <= $num_of_rows; $i++ ){ echo "<tr>n"; for ( $j = 0; $j < 7; $j++ ){ if ( (($i == 1) && ($this->first_day_of_month <= $j)) || (($i > 1) && ($day <= $this->days_in_month)) ){ // date to store in DB is CREATED like this $today = date('Y-m-d',strtotime($this->year . "-" . $this->month . "-" . $day)); $todayTS = strtotime($today); if ($today == date("Y-m-d")) { $cal="cal-today"; } else { $cal="cal"; } echo "<td class="$cal" width="14%" height="" . (100 / $num_of_rows) . "%">"; $this->_popup_link("day",$this->php_self."?display=day&stamp=".$this->stamp."&day=".$day."&returnto=month",$day); echo "<br>"; |
|
#12
|
|||
|
|||
|
RE: Hightlight Current Day
thanx...i got it..
|
![]() |
| Viewing: Codewalkers Forums > Projects > ltwCalendar > Hightlight Current Day |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|