tips and tricks for movable type
calendar cell background colors
May 07, 2003
This is a little coding tip on how to have the background colors of your calendar cells change depending on whether or not you have entries for that day.
Replace this part of the default calendar code:
with this:
Change #FFFFFF to the value of the color you want when there is an entry, and change #000000 to the value of the color you want when there are no entries for that day.
(Note that there's a space following "#FFFFFF" and "#000000" in that code.)
TrackBack: 4
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/149)
» MT Tweaks
Excerpt: General, indispensible links for MT setup and configuration include: Movable Type, the girlie matters, Empty Pages, Scriptygoddess, and CSS Zen Garden. To minimize the tehno-babble on this blog while keeping track of this behemoth project, here is the ...
Weblog: patchwork progression
Tracked: 09.02.03 01:45 PM
» Adjustments
Excerpt: Added some mods today, including "calendar cell background colors" and the previous and next calendar function. More to come....
Weblog: lingosphere daily
Tracked: 11.12.03 08:36 PM
» Table Cell Background Colors
Excerpt: [the girlie matters] tips and tricks: calendar cell background colors...
Weblog: Living Dead Girl
Tracked: 10.19.04 10:45 AM
» Table Cell Background Colors
Excerpt: [the girlie matters] tips and tricks: calendar cell background colors...
Weblog: Tutorials
Tracked: 10.21.04 06:56 PM
Comments
Girlie, how would you make the background show up when you use your (remember this) php code for putting two months of calendar in a row. (note: leading "less than" sign replaced with begin parens so as to make it visible here!)
(div align="center" class="calendar">
(?php
(MTArchiveList lastn="2" archive_type="Monthly">
$monthlyarchivereverse[] =
"
(tr>
(th abbr=\"Sunday\" align=\"center\">Sun
(th abbr=\"Monday\" align=\"center\">Mon
(th abbr=\"Tuesday\" align=\"center\">Tue
(th abbr=\"Wednesday\" align=\"center\">Wed
(th abbr=\"Thursday\" align=\"center\">Thu
(th abbr=\"Friday\" align=\"center\">Fri
(th abbr=\"Saturday\" align=\"center\">Sat
(/tr>
(MTCalendar month="this">
(MTCalendarWeekHeader>
(td bgcolor=\"#00CC00\" align=\"center\">
\">
(MTCalendarIfNoEntries>
(MTCalendarIfBlank> (/MTCalendarIfBlank>
(MTCalendarWeekFooter>
(/MTCalendar>
(/table>";
(/MTArchiveList>
$monthlyarchive = array_reverse($monthlyarchivereverse);
foreach($monthlyarchive as $temp) {
echo $temp;
}
?>
(/div>
Using the code I posted in Two Calendars Reverse Sort, replace:
with:
I think that should do it.
I'll give that a shot, but you know, I was hoping to use both (greedy little bastard that I am): the today tag for one color, the ifentries color for another color...
I tried putting all three in there and it just said "huh"? (or something more serious and PHP relevant)
And, yes, the code is from that post (verbatim). What can I say, I copy your code whenever I can :)
Gratefully and graciously,
Todd
Girlie,
Thanks for the info. How would you go about changing the color of the individual text of the cell for an entry? (As with Todd's comment, the leading angle bracket has been replaced with an open paren.)
I tried changing the code to reflect an additional css class:
(MTCalendarIfEntries>
(MTEntries lastn="1">
(a class="calendarlink" href="($MTEntryPermalink$>">($MTCalendarDay$>(/a>
(/MTEntries>
(/MTCalendarIfEntries>
But that didn't work. Any ideas?
Thanks,
Andy
Well I gave it a whirl as my 1st mod to my blog. It gave me two colored blocks on either side of the date that had an entry which I do not know is the intended effect (I assume that the bgcolor was suppose to be behind the number).
holiday - try editing the background for .calendar in your stylesheet
hi ,
please u can give me how should i hang up all they mobile normale i am relly thanks to u will u please help me for
Hi, I've tried adding the bgcolor in the index template as you posted above but the code came out as text. I did remember to include the space as you said. I'm thinking there should be a way to do it in the CSS. Anyhow, any ideas?
Thanks. :)