Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

calendar widget


Reply


5 Posts   1129 Views

Avatar
marcink

Community Member, 89 Posts

20 April 2009 at 1:30am

hi,

would it be possible to to extract the calendar into an widget? then you could have it on any pages, and when the user clicks on a date, he would be redirected to the calendar page... ???

Avatar
UncleCheese

Forum Moderator, 4096 Posts

20 April 2009 at 4:35am

It already is.

function GlobalCalendarWidget()
{
$calendarPage = DataObject::get_one("Calendar"); // If you have multiple calendars, specify an id or url segment.
return new CalendarWidget($calendarPage);
}

Avatar
marcink

Community Member, 89 Posts

20 April 2009 at 5:25am

that's cool!
but where do i have to put this function, and where do i call it?

thanks!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

20 April 2009 at 8:22am

Edited: 20/04/2009 8:23am

If you want it on every page, the Page_Controller would probably be a good place since all your page types descend from that. It can be called on the template just like any other function.

Avatar
marcink

Community Member, 89 Posts

20 April 2009 at 8:52am

thanks, it works... :)