Hi UncleCheese,
Even I had tried $GlobalCalendarWidget, but after flushing the pag, blank page appears.
As asked, here is the homepage.php code -
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
'AnnouncementText' => 'HTMLText'
);
static $has_one = array(
);
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Announcement', new HtmlEditorField('AnnouncementText', 'Announcement'));
return $fields;
}
}
class HomePage_Controller extends Page_Controller {
function LatestNews($num=3) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}
function UpcomingEvents()
{
return DataObject::get_one("Calendar")->upcomingEvents(5);
}
function GlobalCalendarWidget()
{
$calendarPage = DataObject::get_one("Calendar"); // If you have multiple calendars, specify an id or url segment.
return new CalendarWidget($calendarPage);
}
}
?>
Code for homepage template which is in Layout folder -
<div id="contentLeft">
$Content
$Form
</div>
<div id="contentRight">
<h3>News</h3>
<div class="marquee_text"><marquee scrolldelay = "100"><p>$AnnouncementText</p></marquee>
</div>
<div class="NewsListHomeIn">
<% control LatestNews %>
<a href="$Link" title="$Title" class="newsTitle">$Title</a>
<div class="news_img">$Photo.SetWidth(75)</div>
<div class="news_text">
$Content.LimitWordCount(10)<br/>
<a href="$Link" title="Read more on "{$Title}"">Read more >></a>
</div>
<div class="clear"></div>
</div>
<% end_control %>
</div>
$GlobalCalendarWidget
</div>
<div class="clear"></div>
Regards