7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » on a steep curve..
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 574 Views |
-
on a steep curve..

23 August 2011 at 3:23am
hi,
I am very new to silverstripe and need to find out a few things regarding image/gallery modules. I design sites mostly for artists and art galleries, and need the CMS to be able to handle more advanced image tasks, specifically image galleries with back and forward links and automatic counters. An example of a gallery from one of my sites (currently based on Jquery cycle) is here: http://www.vilmagold.com/newpages/artists/charlesatlas.htm
Is it possible to integrate Cycle into silverstripe or are there silverstipe image modules which would allow my clients to upload their images into a setup like in the page above?
thanks!
thom -
Re: on a steep curve..

23 August 2011 at 4:26am
One thing you'll find that differentiates SilverStripe from other CMSes is that there aren't too many whiz-bang modules that integrate specific behaviors and data models at the click of a button. Rather than force-feed you one specific approach and leave you to wrestle it into submission trying to get it to do what you want, SilverStripe encourages you to build these things yourself, so that they're 100% customized to your liking. Being a very flexible and easy to use framework, this is a process that's highly streamlined.
Here's some example code that might help you with a gallery.
GalleryPage.php
class GalleryPage extends Page {
static $has_many = array (
'GalleryImages' => 'GalleryImage'
);public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Gallery", new ImageDataObjectManager($this, 'GalleryImages','GalleryImage'));
return $fields;
}
}class GalleryPage_Controller extends Page_Controller {
public function init() {
parent::init();
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
Requirements::javascript('path/to/your/plugin.js');
Requirements::css('/path/to/your/plugin/css.css');
}
}GalleryImage.php
class GalleryImage extends DataObject {
static $db = array (
'Caption' => 'Text'
);static $has_one = array (
'Image' => 'Image',
'GalleryPage' => 'GalleryPage'
);public function getCMSFields() {
return new FieldSet (
new ImageUploadField('Image'),
new TextareaField('Caption')
)
}}
/your-theme/templates/Layout/GalleryPage.ss
<div id="your_cycle_thingy">
<% control GalleryImages %>
<% control Image %>
$SetWidth(500) <!-- an image tag for the resampled image -->
$CroppedImage(100,100) <!-- an image tag for a thumbnail, maybe -->
<% control SetWidth(500) %>
<img src="$URL" /> <!-- getting a little more customized -->
<% end_control %>
$Caption
<% end_control %>
</div>As you can see, SilverStripe is very plugin agnostic. You can do whatever you like with the output to your template to make it work with whatever..
Good luck!
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: on a steep curve..

23 August 2011 at 5:50am
When I give a presentation on Silverstripe at our PHP usergroup meeting, I'm going to steal this nice UncleCheese quote because I think it best describes the SilverStripe developer view in a nutshell:
One thing you'll find that differentiates SilverStripe from other CMSes is that there aren't too many whiz-bang modules that integrate specific behaviors and data models at the click of a button. Rather than force-feed you one specific approach and leave you to wrestle it into submission trying to get it to do what you want, SilverStripe encourages you to build these things yourself, so that they're 100% customized to your liking. Being a very flexible and easy to use framework, this is a process that's highly streamlined.
-
Re: on a steep curve..

23 August 2011 at 1:13pm
Haha.. Awesome!
Yeah, I pretty much ran through that rhetoric dozens of times at the CMS Expo in Chicago. Said something along those lines in all my talks and to just about every interested passer-by at the SilverStripe booth.
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com
| 574 Views | ||
|
Page:
1
|
Go to Top |

