5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1216 Views |
-
[SOLVED] Publishing latest news on the homepage

16 January 2009 at 8:54am Last edited: 17 January 2009 10:40am
Hi,
I'm new to SilverStripe and I like the open concept. So I worked through the tutorials and now I'm stuck in tut 2.
To publish the latest news on the homepage, I wrote the following function as described in the tut:
class HomePage_Controller extends Page_Controller {
function LatestNews($num=5) {
$news = DataObject::get_one("NewsHolder");
return ($news) ? DataObject::get("NewsPage", "ParentID = $news->id", "Date DESC", "", $num) : false;
}
}Now when I address the homepage in the browser I get the error
--> The website server has not been able to respond to your request.
The entry in the Apache access.log looks like this:
--> "GET /SilverStripe/ HTTP/1.1" 500 86
Anyone who can get me on the right way? Thanks in advance.
Christian
-
Re: [SOLVED] Publishing latest news on the homepage

16 January 2009 at 4:50pm
try adding ' ' around the DBField
function LatestNews($num=5) {
$news = DataObject::get_one("NewsHolder");
return ($news) ? DataObject::get("NewsPage", "ParentID = '$news->id'", "Date DESC", "", $num) : false;
}Next thing you could try is turning the site into 'Devmode' by adding Director::set_environment_type("dev") to your _config.php file or Check your PHP error logs for a clue
-
Re: [SOLVED] Publishing latest news on the homepage

17 January 2009 at 10:39am
Thanks, obviously the quotes round the variable name $news->id are missing.
Christian
| 1216 Views | ||
|
Page:
1
|
Go to Top |


