CGCalendar display single day - today!
-
- Forum Members
- Posts: 15
- Joined: Thu Feb 04, 2010 11:19 am
CGCalendar display single day - today!
I'm looking for a way to display the current day with all its events. Is there support for such a function or will I need to digg into the code files again?
Re: CGCalendar display single day - today!
looks like a good feature request
could be implemented like {cms_module module='CGCalendar' display='list' today='true'}
could be implemented like {cms_module module='CGCalendar' display='list' today='true'}
Re: CGCalendar display single day - today!
Create new CGCalendar template and instead of looping all over the month show one day only.
Let say you created calendar template 'one_day' that looks like this
Call it
Let say you created calendar template 'one_day' that looks like this
Code: Select all
{assign var='current_day' value='d'|date}
{$days[$current_day].events|debug_display}
Code: Select all
{cms_module module="CGCalendar" display='calendar' calendartemplate='one_day'}
Re: CGCalendar display single day - today!
Thanks ! This may be useful.
Btw, I've just installed the 1.5.2 version and I was wondering why, when I've not defined the day (only the month and the year), the value of {$day} is "Array" ? In the event list, the first line is 'Array April 2010'. (I'm using the french version)
Btw, I've just installed the 1.5.2 version and I was wondering why, when I've not defined the day (only the month and the year), the value of {$day} is "Array" ? In the event list, the first line is 'Array April 2010'. (I'm using the french version)
-
- Forum Members
- Posts: 15
- Joined: Thu Feb 04, 2010 11:19 am
Re: CGCalendar display single day - today!
There's one problem with it. It does not display the name of the day...Peciura wrote: Create new CGCalendar template and instead of looping all over the month show one day only.
Let say you created calendar template 'one_day' that looks like thisCall itCode: Select all
{assign var='current_day' value='d'|date} {$days[$current_day].events|debug_display}
Code: Select all
{cms_module module="CGCalendar" display='calendar' calendartemplate='one_day'}
Re: CGCalendar display single day - today!
In short you are trying to use array as a string that is why it outputs "Array". You should access array members instead. You can see how to access member by its number and by key and ask more info about variable (possibly array toothe value of {$day} is "Array"

Knowing that it should be easy to inspect variable you want.{$days[$current_day].events|debug_display}
@rightwebdev it was exact answer to question. But if you post your template and link to page i am sure we could build smth more appealing.
Last edited by Peciura on Fri Apr 23, 2010 6:59 am, edited 1 time in total.
-
- Forum Members
- Posts: 15
- Joined: Thu Feb 04, 2010 11:19 am
Re: CGCalendar display single day - today!
http://web1.lunarum.com/index.php?page=diary This is the main calendar. Now I would like to show the current day with name, date and all the events in the upper right hand corner. I think this can _almost_ be done with css alone. Hide all the days except the current day. But the same problem occurs - no way to add the name of the day.
Re: CGCalendar display single day - today!
EDIT :
I noticed there is one undocumented parameter "day" in CGCalendar 1.5.2. Just call it like this and you will have events of current day only
/*---------------------------- left just because it was first suggestion ------------------------*/
It is also basic i am sure you will style it the way you want. CGCalendar calendar template 'one_day'
To display one day - specify template
I noticed there is one undocumented parameter "day" in CGCalendar 1.5.2. Just call it like this and you will have events of current day only
If you need name of week day - add this smarty code to CGCalendar list template{cms_module module='CGCalendar' display='list' day='d'|date}
{assign var='weekday' value='N'|date}
{assign var='weekday' value="`$weekday-1`"}
{$day_names[$weekday]} {*name of week day*}
/*---------------------------- left just because it was first suggestion ------------------------*/
It is also basic i am sure you will style it the way you want. CGCalendar calendar template 'one_day'
Code: Select all
{assign var='current_day' value='d'|date}
{assign var='weekday' value='N'|date}
{assign var='weekday' value="`$weekday-1`"}
{strip}
{$day_names[$weekday]} {$current_day} {$month_names[$month]} {$year}<br/>
{assign var='day' value=$days[$current_day]}
{if !empty($day.events)}
<div {if isset($day.class)}class="{$day.class}"{/if}>
<ul>
{foreach from=$day.events item=event}
<li><a href="{$event.url}">{$event.event_title}</a></li>
{/foreach}
</ul>
</div>
{else}
No events
{/if}
{/strip}
Code: Select all
{cms_module module='CGCalendar' display='calendar' calendartemplate='one_day'}
Last edited by Peciura on Fri Apr 23, 2010 9:37 am, edited 1 time in total.
-
- Forum Members
- Posts: 15
- Joined: Thu Feb 04, 2010 11:19 am
Re: CGCalendar display single day - today!
This looks splendid
Will try it out later tonight.

Re: CGCalendar display single day - today!
Hello,
I use the cgcalendar module to display a restaurant menu. On the homepage, I'm using the "day" parameter to show the current day menu, it's working like a charm.
But. I have another problem / request : I need to display on another page the current week menus= 5+2 events, the last 2 are for the weekend and display the same information. The thing is how do I set the current week? I know it's with smarty tags, but can't figure out how to do it.
Thanx for your help.
I use the cgcalendar module to display a restaurant menu. On the homepage, I'm using the "day" parameter to show the current day menu, it's working like a charm.
But. I have another problem / request : I need to display on another page the current week menus= 5+2 events, the last 2 are for the weekend and display the same information. The thing is how do I set the current week? I know it's with smarty tags, but can't figure out how to do it.
Thanx for your help.
Re: CGCalendar display single day - today!
First of all you need to now current week start time and then call CGCalendar foreach day (that is 7 times in you case).
Here is basic template to list events for current week. Do not forget to use appropriate list template.
Here is basic template to list events for current week. Do not forget to use appropriate list template.
Code: Select all
{if 1!='%w'|strftime}
{assign var='date_string' value='last monday'}
{else}
{assign var='date_string' value=''}
{/if}
{section start='0' loop='7' name='current_week'}
<br/>
{assign var='cgcal_unixtimestamp' value=$date_string|cat:' + %s day'|sprintf:$smarty.section.current_week.index|strtotime}
{CGCalendar display='list' year='Y'|date:$cgcal_unixtimestamp month='m'|date:$cgcal_unixtimestamp day='d'|date:$cgcal_unixtimestamp listtemplate='list'}
{/section}
Re: CGCalendar display single day - today!
thanx a lot, I'll try it and let you know.
Last edited by Franck on Mon Nov 08, 2010 11:03 am, edited 1 time in total.
Re: CGCalendar display single day - today!
It's working perfectly, your help is highly appreciated!
I have a weird thing with the 'day' parameter: it's the day+1 event that's displayed instead of day. Do you have any clue about what could be wrong? I first thought of a timezone, but my server seems to be configured ok.
I have a weird thing with the 'day' parameter: it's the day+1 event that's displayed instead of day. Do you have any clue about what could be wrong? I first thought of a timezone, but my server seems to be configured ok.
Re: CGCalendar display single day - today!
Paste this before {CGCalendar} to see date passed to module
I guess smth weird is in your list template.
What is your time zone (mine +2 ) and locale (mine lt_LT.UTF-8) ?
If nothing works you could simply do
Code: Select all
{'c'|date:$cgcal_unixtimestamp}
What is your time zone (mine +2 ) and locale (mine lt_LT.UTF-8) ?
If nothing works you could simply do
but i consider it as debugging step only.{CGCalendar display='list' year='Y'|date:$cgcal_unixtimestamp month='m'|date:$cgcal_unixtimestamp day='d'|date:$cgcal_unixtimestamp-1 }
Re: CGCalendar display single day - today!
it's really weird in fact: I can't really tell how it's displaying, as yesterday shows the news for today, and today also the one for today. Well... ?
Oh a detail that might be important: I'm using the eventtemplate and display='event'.
By the way, thanx a lot for your help!
Oh a detail that might be important: I'm using the eventtemplate and display='event'.
By the way, thanx a lot for your help!