I have launched about 5 or 6 SilverStripe installations, many of which use the imagefield following the example in tutorial 2: http://doc.silverstripe.org/tutorial:2-extending-a-basic-site. The sites I've launched using SS v2.3.x work fine, but with the last 2 sites, which use v2.4.1 the imagefields are not working for me.
I've tried several variations of code and all yield the same result in 2.4.1: The image field displays a page not found page using whatever template is set for the site. Specifically, the error is: Sorry, it seems you were trying to access a page that doesn't exist. Please check the spelling of the URL you were trying to access and try again.
I have had no luck determining the difference between my v2.3 sites where the image field works as expected and the v2.4.1 sites where it doesn't. Any assistance is appreciated.
The latest rendition of the code is:
<?php
class SalonPage extends Page {
public static $db = array(
);
static $has_one = array(
'Photo' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$picField = new ImageField('Photo');
$fields->addFieldToTab("Root.Content.Images", $picField);
return $fields;
}
}
class SalonPage_Controller extends Page_Controller {
public function init() {
parent::init();
}
}
?>