Hello all,
I'm trying to add an Image field to the Event Calendar. I followed Tutorial 2, and ended up with this in:
CalendarEvent.php
class CalendarEvent extends Page
{
static $has_one = array (
'EventPhoto' => 'Image'
);
}
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Images", new ImageField('EventPhoto'));
return $f;
That works fine as far as I can see. In the CMS, under Page Type Calendar Event there is an image tab, and it lets me upload the image.
Th problem comes with the site, when I try to get the image in the code:
<div id="Photo">
$EventPhoto
</div>
I just end up with a "Website Error" Screen, when I acces the particular event.
Does anyone have any ideas on where i'm going wrong?