Hey,
I'm very new to SilverStripe, so sorry for this newbie post and my bad english. I'm using SilverStripe for one month and I'm lovin it :) For my actual project I integrated already my own template, my own gallery extension (with help of some forum posts and this great DataObjectManager).
Now I will create a new CMS-DropDown-Field for every page, where you can change the slideshow. My idea was:
I have slideshow images in 3 different HTMLs as .ss files in "themes/mylayout/templates/Insludes/" (officeSlideshows.ss …). I have written following to my mysite/code/Page.php:
…
public static $db = array(
// Change Slideshow - Dropdownfields
'SliderDesign' => "Enum('officeSlideshow, productSlideshow, otherSlideshow')"
);
// Choose Slideshow as default
public static $defaults = array(
'SliderDesign' => 'officeSlideshow'
);
// Add a Dropdownfield to CMS
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new DropdownField('SliderDesign', 'Choose your header slideshow', singleton('Page')->dbObject('SliderDesign')->enumValues()), 'Content');
return $fields;
}
…
Now I can see this drop down field in my backend and I can change the value, yeah :)
And now? I thought, I could add following to my theme (Page.ss):
…
<div id="topslider">
<% include $SliderDesign %>
</div>
…
… and it would change to one of my variable values (e.g. officeSlideshow) and insert the content of officeSlideshow.ss (from includes/), but it doesn't! -.-
What I'm doing wrong?
Or is there a better way to change Layoutparts (like different slideshows) in the Backend of SilverStripe?