10376 Posts in 2191 Topics by 1708 members
| Go to End | Next > | |
| Author | Topic: | 5180 Views |
-
Re: Event Calendar Widget on Home page

25 April 2011 at 1:55am
Thanks for the info - resolved the issue I was having in getting a global calendar showing
-
Re: Event Calendar Widget on Home page

2 May 2011 at 3:59am
Hello all!
I´m running a site for our small travel agency so I thought it would be nice to have the upcoming events posted on the HomePage. The calendar works fine on it´s calendarpage but how do I get it to work on the HomePage? I followed your little tutorial here and it got me the calendar widget which isn´t what i want.
Is there a possibility to e.g. post 5 upcoming events (without the calendar widget) on my HomePage? Can someone give me the codes for the HomePage.php and HomePage.ss ???many thanks in advance
kind regards
tchintchie -
Re: Event Calendar Widget on Home page

2 May 2011 at 2:02pm
<% control UpcomingEvents%>
$_Dates $EventTitle $Link
<% end_control%> -
Re: Event Calendar Widget on Home page

3 May 2011 at 2:21am
UncleCheese, thanks for the code. But obviously it´s not enough to just simply paste it into my HomePage.ss ?? Is there something else I need to add to my HomePage.php? here´s what it looks like at the moment:
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
function LatestNews($num=5) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}
static $icon = "themes/tutorial/images/treeicons/home";
}
class HomePage_Controller extends Page_Controller {
function GlobalCalendarWidget()
{
$calendarPage = DataObject::get_one("Calendar"); // If you have multiple calendars, specify an id or url segment.
return new CalendarWidget($calendarPage);
}
function UpcomingEvents()
{
return DataObject::get_one("Calendar")->upcomingEvents(5);
}
}sorry for being a noob :-/
thanks in advance!
-
Re: Event Calendar Widget on Home page

3 May 2011 at 6:23am
No, that function is decorated into your SiteTree class, so you don't need to write any code. It's added automatically by the module.
-
Re: Event Calendar Widget on Home page

3 May 2011 at 7:56am
*sigh* thanks so much for the quick reply and your patience...however I really meant it when I said "noob" :-D Ok, so I decorated the above mentioned functions of the calendar-code to my SiteTree.php (so far so good?)
I did a dev/build --> nothing happened. Added
<% control UpcomingEvents%>
$_Dates $EventTitle $Link
<% end_control%>
to my HomePage.ss and ran a dev/build again. Still nothing.
I really feel bad about bothering you with my noob-problems but it would be such a nice feature. But it seems I need a step-by-step tutorial on that. Anyone has pity on me??thanks again
-
Re: Event Calendar Widget on Home page

3 May 2011 at 11:41am
No, you shouldn't have to do any decorating. The module does it for you. That control block should work out of the box.
-
Re: Event Calendar Widget on Home page

7 May 2011 at 1:02am
alright, found another (older) post where someone intented to do the same. I even got the upcoming events working on my homepage BUT...when I click on the event link it gives me the error page. I´ve read that this issue was supposed to be fixed with a SVN update but since I just recently downloaded that module I don´t think there´s a newer version? btw those posts where from 2009 ... :-/ maybe not compatible with SS 2.4.5??
| 5180 Views | ||
| Go to Top | Next > |

