Hi
I have a page type called 'Tour' with up to 10 Images attached to it:
class Tour extends Page {
static $db = array(
'TourTeaser' => 'Text'
);
static $defaults = array(
'SlideImgWidth' => 200
);
static $has_one = array(
'MyTourRegion' => 'TourRegion',
'MainImage' => 'Image',
'Photo1' => 'Image',
'Photo2' => 'Image',
'Photo3' => 'Image',
'Photo4' => 'Image',
'Photo5' => 'Image',
'Photo6' => 'Image',
'Photo7' => 'Image',
'Photo8' => 'Image',
'Photo9' => 'Image',
'Photo10' => 'Image'
);
....
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo1') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo2') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo3') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo4') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo5') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo6') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo7') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo8') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo9') );
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo10') );
What I am trying to do is to pull those images out when the page is viewed like $Photo1.SetWidth(150), $Photo2.SetWidth(150) etc. Got this part fine.
But in my Tour.ss template, I am trying to add these images to a JS/CSS slideshow. For this, each image requires to be of a specific css class of 'full'.
Is there any way of doing this with Silverstripe? E.g. Image1.SetCSSClass('full'). Can't find any doco on this.
Cheers
Aaron