Any additional Google Calendar template samples?
Any additional Google Calendar template samples?
I'm going to start working on some additional templates for Google Calendar. Does anyone have any more samples other than the one that comes with the module?
Thanks!
Thanks!
Re: Any additional Google Calendar template samples?
Here's what I've got so far - just a couple of very basic changes (which still took me like an hour to figure out, since I've never touched Smarty before...):
Main difference is the line at the top that shows the date range (figured from the current date and the number of days you specify as a parameter). Also just added the end time in the event listing itself.
I'd like to do quite a bit more, but we'll see how it goes. Ideally I'd like to have it closer to the actual Google Calendar in functionality - being able to display more like a calendar, choose date ranges, etc... but that may not be a great idea given how much time it'll take. Might just embed a google calendar, or switch to the regular calendar module so CMSms users can add/modify events. We'll see.
But I figured I'd share this code, anyway, in case people find it helpful.
Code: Select all
{php}
$all_tpl_vars = $this->get_template_vars('actionparams');
$range = ($all_tpl_vars['days']);
$future = mktime(0,0,0,date("m"),date("d")+$range,date("Y"));
$future = date("Y/m/d", $future);
$this->assign('future', $future);
{/php}
<h3>Events from {$smarty.now|date_format:"%Y-%m-%d"} to {$future|date_format:"%Y-%m-%d"} </h3>
<div id="thisweek">
<dl>
{foreach from=$events item=event}
{if $event.first_of_day}
<dt>{$event.start|date_format:"%A %e %B"}</dt>
{/if}
{if $event.all_day}
<dd class="allday">{$event.title}</dd>
{else}
<dd>{$event.start|date_format:"%l.%M%P"} - {$event.end|date_format:"%l.%M%P"}<br>{$event.title}</dd>
{/if}
{/foreach}
</dl>
</div>
I'd like to do quite a bit more, but we'll see how it goes. Ideally I'd like to have it closer to the actual Google Calendar in functionality - being able to display more like a calendar, choose date ranges, etc... but that may not be a great idea given how much time it'll take. Might just embed a google calendar, or switch to the regular calendar module so CMSms users can add/modify events. We'll see.

Re: Any additional Google Calendar template samples?
I tried this template and the top PHP part doesn't show the future date correctly. It is always the current date to current date. And I made sure that the days parameter is set and verified it worked by noticing events spanning multiple days in the listing.
Re: Any additional Google Calendar template samples?
*shrug* I don't know - it worked for me no problem. If you echo $future in the php code, what does it give you?
Re: Any additional Google Calendar template samples?
echo $future -> 2009/01/30
echo $range -> nothing
my page content is:
{cms_module module="GoogleCalendar" days=30}
echo $range -> nothing
my page content is:
{cms_module module="GoogleCalendar" days=30}
Re: Any additional Google Calendar template samples?
Hmmm....well, if it's not getting the range, that would explain it. Can you echo $all_tpl_vars?
Re: Any additional Google Calendar template samples?
Also, {$event.title} returns 'Object id #xxx' where xxx is some number
Re: Any additional Google Calendar template samples?
That is empty as wellteleute wrote: Hmmm....well, if it's not getting the range, that would explain it. Can you echo $all_tpl_vars?
Re: Any additional Google Calendar template samples?
What version of Google Calendar are you using?
Re: Any additional Google Calendar template samples?
http://calendar.google.com I don't see any version.teleute wrote: What version of Google Calendar are you using?
Re: Any additional Google Calendar template samples?
I mean of the module. Should be in your admin under Extensions > Modules.
Re: Any additional Google Calendar template samples?
0.1.1teleute wrote: I mean of the module. Should be in your admin under Extensions > Modules.
Re: Any additional Google Calendar template samples?
I'm sorry - I don't know why those variables would be blank, then. I really don't have any more time to try to check this out today, since it worked for me and I don't have the module installed anymore. If I get more time later I'll try to look at it again.
Re: Any additional Google Calendar template samples?
I'll bump this because I'm looking for the same. No php experience so I'm kind of relying on the expertise of others here. I'd like to have the ability to do a smaller version of something that really looks like a calendar as well as having the listed events (like the tiny calendar on wordpress sites) as well as have some alternate text when there are not upcoming events, rather than having a big blank space in the sidebar.
And thank you, teleute, I was able to add some of your modifications and better figure out how everything works at the same time. Would you happen to have any idea why my times might be offset by an hour though? The timezone is correct in my config.php (correcting that fixed the time displayed by current_time tag so I know that was part of the problem) but my events still show up an hour too early. Everything looks good in my actual google calendar, though.
Edit====
In my search, I came across this: http://code.google.com/apis/gdata/articles/calvis.html but I don't know exactly what I'm looking at.
What I think I'm seeing is a framework for displaying the Google Calendar visually without that ugly surrounding chrome you have with a full embed. Can this visual framework work with the GoogleCalendar module, and if so, how exactly would I go about it? I see with this CalVis code the CSS ids are defined... are those universal (therefore you can apply the CSS there and modify the calendar that way) or is this all just something else altogether?
And thank you, teleute, I was able to add some of your modifications and better figure out how everything works at the same time. Would you happen to have any idea why my times might be offset by an hour though? The timezone is correct in my config.php (correcting that fixed the time displayed by current_time tag so I know that was part of the problem) but my events still show up an hour too early. Everything looks good in my actual google calendar, though.
Edit====
In my search, I came across this: http://code.google.com/apis/gdata/articles/calvis.html but I don't know exactly what I'm looking at.

Last edited by brocki on Wed Mar 11, 2009 5:59 am, edited 1 time in total.