hi uncle cheese,
seems yesterday i was a bit too tired to be really clear.
what i try to do ist the following:
i have a page extending the Calendar class called EventAlle.php which is the holder for all the EventSeite.php pages extending the CalendarEvent class.
the EventSeite.php pages have a ImageDataObjectManager to be able to add them more than only one picture.
this is defined in the MorePic.php that extends the DataObject class.
the relationship between EventSeite.php and MorePic.php is defined via EventSeiteDateTime.php.
as far as i got everything right studying the tuts and your posts, this should be ok.
all this also works very well inside the cms, and the DB entrys also look ok to me.
the problem is i can't access the pictures from within the templates. i tried nearly every way i could imagine according to the tutorials, but nothing worked out.
though i'm quite convinced there HAS to be a way, but i'm afraid either i'm blind or my nickname is choosen badly... :-)
i put the sourcodes here:
EventAlle.php:
<?php
class EventAlle extends Calendar {
static $db = array(
);
static $has_one = array('Chronikbild' => 'Image');
static $has_many = array ('Vorstellungen' => 'EventSeite');
static $allowed_children = array('EventSeite');
static $icon = "themes/tads/images/treeicons/event";
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Standardbild", new ImageField('Chronikbild', 'Standardbild für Chronik'));
return $fields;
}
}
class EventAlle_Controller extends Calendar_Controller {
}
?>
EventSeite.php:
<?php
class EventSeite extends CalendarEvent {
static $db = array(
'Premiere' => 'Date',
'Urauffuehrung' => 'Date',
'Stab' => 'HTMLText'
);
static $has_one = array();
static $has_many = array('Dates' => 'EventSeiteDateTime');
static $icon = "themes/tads/images/treeicons/event";
function getCMSFields() {
$fields = parent::getCMSFields();
$manager = new ImageDataObjectManager($this, 'MorePic', 'MorePic', 'Attachment',
array('Name' => 'Name', 'Description' => 'Description'),
'getCMSFields_forPopup'
);
$manager->setAddTitle('Mehr Szenenbilder');
$manager->setPluralTitle('Weitere Szenenbilder');
$manager->setBrowseButtonText('Bilder hochladen (nur JPG)');
$fields->addFieldToTab("Root.Content.Bilder",$manager);
$fields->addFieldToTab("Root.Content.Main", new CalendarDateField('Premiere'), 'Content');
$fields->addFieldToTab("Root.Content.Main", new CalendarDateField('Urauffuehrung'), 'Content');
$fields->addFieldToTab("Root.Content.Main", new HtmlEditorField('Stab'), 'Content');
return $fields;
}
}
class EventSeite_Controller extends CalendarEvent_Controller {
}
?>
MorePic.php
<?php
class MorePic extends DataObject {
static $db = array ('Name' => 'Text', 'Description' => 'Text');
static $has_one = array ('Attachment' => 'Image', 'EventSeite' => 'EventSeite');
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Description', 'Beschreibung'),
new FileIFrameField('Attachment', 'Bild')
);
}
}
?>
EventSeiteDateTime.php
<?php
class EventSeiteDateTime extends CalendarDateTime
{
static $db = array ();
static $has_one = array ('EventSeite' => 'EventSeite');
static $has_many = array ('MorePic' => 'MorePic');
}
?>
by the way, i'm really new to silverstripe and hope i don't embarrass myself by a really stupid mistake i've made. i'm a beginner...
thanx for your help!
cheers, p.