Hi
I'm pretty new to SilverStripe and I have a problem. I was following this tutorial http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/ and have got as far as the StaffPage page type bit. I am doing it slightly differently but I have encountered a 500 internal server error. I am completely clueless about how to solve this so I would really appreciate some help.
//The StaffMember class in the tutorial but I called it Article
<?php
class Article extends DataObject
{
//db fields
static $db = array (
'Headline' => 'Text',
'DatePublished' => 'Date',
);
//relationships
static $has_one = array (
'ArticlePage' => 'ArticlePage',
'Photo' => 'Image'
);
//fields for DOM table
static $summary_fields = array (
'Thumb' => 'Photo',
'Headline' => 'Headline'
);
public function getCMSFields()
{
return new FieldSet(
new TextField('Headline'),
new DateField('DatePublished'),
new ImageField('Photo')
);
}
publiv function getThumb()
{
if($this->PhotoID)
return $this->Photo()->CMSThumbnail();
else
return '(No Image)';
}
}
?>
//The StaffPage page but I called it ArticlePage
<?php
class ArticlePage extends Page
{
static $has_many = array(
'Articles' => 'Article'
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new DataObjectManager(
$this,
'Articles',
'Article'
);
$fields->addFieldToTab("Root.Content.Articles", $manager);
return $fields;
}
}
class ArticlePage_Controller extends Page_Controller
{
}
?>
Thanks
Edit: I figured out that it was simply a problem with my code. Lesson to me to always reread the code. I am still getting an error even though the pages are appearing that says refused to set unsafe header "Connection"