color coding you calendar events... (CGCalendar/Calendar1.0)
color coding you calendar events... (CGCalendar/Calendar1.0)
Ok.. for the calendars it's
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
for the lists it's
{foreach from=$event.categories key=key item=item}{$key}{/foreach}
so a list sample would be:
{foreach from=$events key=key item=event}
{$event.event_title}
...etc to close {/foreach}
then you just CSS it up and off you go...
cheers
jeremyBass
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
for the lists it's
{foreach from=$event.categories key=key item=item}{$key}{/foreach}
so a list sample would be:
{foreach from=$events key=key item=event}
{$event.event_title}
...etc to close {/foreach}
then you just CSS it up and off you go...
cheers
jeremyBass
-
- Forum Members
- Posts: 28
- Joined: Thu Jan 08, 2009 1:28 pm
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
Thx for this.
Is there a way to output the id of the category instead of the name?
Is there a way to output the id of the category instead of the name?
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
Not that I know of with out a custom UDT. question.. why ? there may be another way to simulate an event id, but it'd be all wall the off stuff... Sorry
cheers
jeremyBass
cheers
jeremyBass
-
- Forum Members
- Posts: 28
- Joined: Thu Jan 08, 2009 1:28 pm
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
I had Germanic Umlauts (öäü) in my categories, with renaming it I can use the category names.
this code works fine for "upcominglist"
but when I want to use it in "yearlist" I don´t get any categories.
this code works fine for "upcominglist"
Code: Select all
{foreach from=$event.categories key=key item=item}{$key}{/foreach}
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
did you try the
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
??
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
??
-
- Forum Members
- Posts: 28
- Joined: Thu Jan 08, 2009 1:28 pm
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
yes, didn´t work, too
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
well.. what is "yearlist"? what it the template and it's code..?
-
- Forum Members
- Posts: 28
- Joined: Thu Jan 08, 2009 1:28 pm
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
Code: Select all
<table>
<caption>Termine:</caption>
<thead>
<tr>
<th colspan="2">Datum</th>
<th>Uhrzeit</th>
<th>Betreff</th>
</tr>
</thead>
<tbody>
{foreach from=$events key=key item=event}
{assign var=month_number value=$event.event_date_start|date_format:"%m"}
<tr class="{foreach from=$event.categories key=key item=item}{$key}{/foreach}">
<td>{$event.event_date_start|date_format:"%d."} {$month_names[$month_number]}</td>
<td>{$event.event_date_start|date_format:"%a"}</td>
<td>{$event.event_date_start|date_format:"%H:%M"}</td>
<td>{$event.event_title}</td>
</tr>
{/foreach}
</tbody>
</table>
I use Calendar Version 1.0
{cms_module module='Calendar' display='yearlist'} Makes a list of the events in this year and use the template in the List-Tap.
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
@ hexdj
handy is it not?... sorry it was award night nigt, I won alot, yeah me lol.... and it was a bet tro drink a shoot for every gold... off to the internationals.. hehe...
ok that was not that relatvented but three of the gold awards were for CMSMS sites I mmade...
CDheers, one more round to everyone, ted to calgay to alby to ronnyk _sgi_.. ecft...
ok... I'm out... GO CMSMS
jeremy
handy is it not?... sorry it was award night nigt, I won alot, yeah me lol.... and it was a bet tro drink a shoot for every gold... off to the internationals.. hehe...
ok that was not that relatvented but three of the gold awards were for CMSMS sites I mmade...

CDheers, one more round to everyone, ted to calgay to alby to ronnyk _sgi_.. ecft...
ok... I'm out... GO CMSMS
jeremy
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
I really need this functionality, but cannot figure out how to get it to work.
Using CMSMS 1.6.5, and CGcalendar 1.2.3
I have a Calendar template, which is the default. I simply want to add the class, or ID, or array index of the Category in the template to control styling.
When I look at the output in Firefox (firebug) it shows the class as "calendar-event0" no matter which category its in. I cannot get a value other than this. Can you tell me what I'm doing wrong?
Using CMSMS 1.6.5, and CGcalendar 1.2.3
I have a Calendar template, which is the default. I simply want to add the class, or ID, or array index of the Category in the template to control styling.
Code: Select all
{strip}
<table class="calendar" id="cal-calendar">
<caption class="calendar-month"><span class="calendar-prev"><a href="{$navigation.prev}">«</a></span> {$month_names[$month]} {$year} <span class="calendar-next"><a href="{$navigation.next}">»</a></span></caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th abbr="{$day}">{$day_short_names[$key]}</th>
{/foreach}</tr>
<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}"> </td>
{/if}
{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
{assign var=weekday value=0}
</tr>
<tr>
{/if}
<td {if isset($day.class)}class="{$day.class}"{/if}>
{if isset($day.events.0)}<a href="{$day.url}">{$key}</a>
<ul>
{foreach from=$day.events item=event}
<!-- HERE IS WHERE I ADDED THE TAG --> <div class="calendar-event {foreach from=$event.categories key=key item=item}{$key}{/foreach}">
<li><a href="{$event.url}">{$event.event_title}</a></li>
<!-- CLOSING DIV TAG FOR ABOVE ADDED ELEMENT--></div>
{/foreach}
</ul>
{else}{$key}{/if}
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}
{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}"> </td>
{/if}
</tr>
</tbody></table>
{/strip}
When I look at the output in Firefox (firebug) it shows the class as "calendar-event0" no matter which category its in. I cannot get a value other than this. Can you tell me what I'm doing wrong?
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
so really it's like this...
{foreach from=$event.categories key=key item=item}{$key}{/foreach}
or
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
those will out put the cats... so then you stick it in where you wish like this example...
class="calendar-event {foreach from=$event.categories key=key item=item}{$key}{/foreach}"
you may be able to do
{$event.categories->category_name}
but I have not tested...
Hope this helps...
Cheers
Jeremy
note... try
{foreach from=$event.categories key=key item=item}{$key}{/foreach}
or
{foreach from=$event.categories key=category item=item}{$item.category_name}{/foreach}
those will out put the cats... so then you stick it in where you wish like this example...
class="calendar-event {foreach from=$event.categories key=key item=item}{$key}{/foreach}"
you may be able to do
{$event.categories->category_name}
but I have not tested...
Hope this helps...
Cheers
Jeremy
note... try
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
Thanks so much Jeremy...this is what worked in the template for me:
{$event.event_title}
{$event.event_title}
Re: color coding you calendar events... (CGCalendar/Calendar1.0)
Np... helping is good karma for the soul 

Re: color coding you calendar events... (CGCalendar/Calendar1.0)
CGCalendar 1.2.5
This template and CSS sets color according category of the event. If event belongs to multiple categories, depending on CSS, day can have combination of category markings or day can be marked with "multiple category" pattern ( uncomment class "cgcalendar_multiple_category").

Template
Basic CSS for CGCalendar.
This template and CSS sets color according category of the event. If event belongs to multiple categories, depending on CSS, day can have combination of category markings or day can be marked with "multiple category" pattern ( uncomment class "cgcalendar_multiple_category").
Template
Code: Select all
{strip}
<table class="calendar" id="cal-calendar">
<caption class="calendar-month">
<span class="calendar-prev">
<a href="{$navigation.prev}">
«
</a>
</span>
{$month_names[$month]} {$year}
<span class="calendar-next">
<a href="{$navigation.next}">
»
</a>
</span>
</caption>
<tbody>
<tr>
{foreach from=$day_names item=day key=key}
<th abbr="{$day}">
{$day_short_names[$key]}
</th>
{/foreach}
</tr>
<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}"> </td>
{/if}
{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
{assign var=weekday value=0}
</tr>
<tr>
{/if}
<td >
<div class='cgcalendar_day' id='cgcalendar_day_{$key}'>
{if isset($day.class)}
<div class="{$day.class}">
{/if}
{if isset($day.events.0)}
{assign var='cgcalendar_multiple_category' value=''}
{assign var='first_category' value=''}
{foreach from=$day.events item=event}
{foreach from=$event.categories item=category}
<div class="cgcalendar_category_{$category.category_id} cgcalendar_category
{if $first_category==''}
{assign var='first_category' value=`$category.category_id`}
{elseif $first_category!=$category.category_id}
{assign var='cgcalendar_multiple_category' value=`$category.category_id`}
{/if}
">
{/foreach}
{/foreach}
{if !empty($cgcalendar_multiple_category)}
<div class='cgcalendar_multiple_category'>
{/if}
<a href="{$day.url}">{$key}</a>
{if !empty($cgcalendar_multiple_category)}
</div>
{/if}
{foreach from=$day.events item=event}
{foreach from=$event.categories item=category}
</div>
{/foreach}
{/foreach}
<div class='cgcalendar_info'>
<ul style='float:left;'>
{foreach from=$day.events item=event}
<li>
<a href="{$event.url}">
{$event.event_title}
</a>
</li>
{/foreach}
</ul>
</div>
</div>
{else}
{$key}
{/if}
{if isset($day.class)}
</div>
{/if}
</div>
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}
{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}"> </td>
{/if}
</tr>
</tbody>
</table>
{/strip}
Code: Select all
/* CGCalendar*/
div.cgcalendar_day{
position: relative;
text-align:right;
}
.cgcalendar_category, .cgcalendar_day, .cgcalendar_multiple_category {
width:21px;
min-width:21px;
height:21px;
min-height:21px;
}
div.cgcalendar_day div.cgcalendar_info{
display:none;
z-index:2;
position: absolute;
bottom:1.3em;
left:0px;
background-color:#ffffff;
border: solid 1px #CEDE95;
}
#cal-calendar div.cgcalendar_info ul{
padding:0px;
margin: 1em 2em;
text-align:left;
}
div.cgcalendar_day:hover div.cgcalendar_info, div.cgcalendar_day div.cgcalendar_info :hover{
display:block;
}
/*.cgcalendar_multiple_category{
background-color:#ECEBE6;
}*/
.cgcalendar_category_1, .cgcalendar_category_2, .cgcalendar_category_3, .cgcalendar_category_4{
background-image:url('images/cgcalendar_category.png');
background-repeat:no-repeat;
background-color:transparent;
}
.cgcalendar_category_1{
background-position:-11px -11px;
}
.cgcalendar_category_2{
background-position:11px -11px;
}
.cgcalendar_category_3{
background-position:-11px 11px;
}
.cgcalendar_category_4{
background-position:11px 11px;
}
table#cal-calendar .calendar-today{
border:1px solid #ff0000;
z-index:1;
text-align:center;
}
Last edited by Peciura on Wed Jan 13, 2010 6:28 pm, edited 1 time in total.