3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 335 Views |
-
500 Internal Server Error

3 August 2012 at 12:27am Last edited: 3 August 2012 1:22am
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
<?phpclass 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"
-
Re: 500 Internal Server Error

4 August 2012 at 6:34am
You have a typo: publiv function getThumb()
Cheers, Martine
| 335 Views | ||
|
Page:
1
|
Go to Top |

