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.

Archive

Our old forums are still available as a read-only archive.

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

Use of DataObject::


Reply

3 Posts   1156 Views

Avatar
Charly

7 March 2008 at 2:29pm Community Member, 6 Posts

O.K, newbie question.

I have put the following code into a Page called NewPage.php:

class NewPage extends Page {
   static $db = array(
   );

static $has_one = array(
);

}

class NewPage_Controller extends Page_Controller {

function newFunction1() {
return DataObject::get("Page", "ParentID=0");
}

}

In NewPage.ss I call newFunction1 by using:

<% control newFunction1 %>

<li><a href="$Link" title="Go to the $Title.XML page"><span>$MenuTitle.XML</span></a></li>

<% end_control %>

When I then access the page, I get the following error:

ERROR:
Error
The website server has not been able to respond to your request.

What have I missed?

Avatar
Willr

7 March 2008 at 9:20pm Forum Moderator, 5511 Posts

well first - open _config.php and add Director::set_environment_type("dev"); so you can see a more useful error apart from the blank error page!

Avatar
Charly

10 March 2008 at 11:53am Community Member, 6 Posts

Thanks, the extra debugging info is very helpful. I rebuilt the page it works fine. I think I had a typo....