I have Gallery and error 500 on page ;-/
My code is:
in page.php
class Page extends SiteTree {
private static $many_many = array (
'Gallery' => 'Image'
);
function getCMSFields()
{
$fields = parent::getCMSFields();
if($this->ID) {
$uploadField = new UploadField(
$name = 'Gallery',
$title = 'Photos:');
$pathTo = 'article/' . $this->ID . '/gallery';
$uploadField->setFolderName($pathTo);
$fields->addFieldToTab('Root.Gallery', $uploadField);
}
return $fields;
}
}
class Page_Controller extends ContentController {
.....
public function Randomlmage(){
return Galeria::get()->sort('RAND()')->First();
}
in page.ss
<% loop RandomImage %>
<img src="$URL" alt="$Title" />
<% end_loop %>
Anyone can help me? I don't have access to server error logs.