Thanks for the info - resolved the issue I was having in getting a global calendar showing :)
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- 5
- Next 10 entries
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
<% control UpcomingEvents%>
$_Dates $EventTitle $Link
<% end_control%>
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!
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.
*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 :)
No, you shouldn't have to do any decorating. The module does it for you. That control block should work out of the box.
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??
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- 5
- Next 10 entries