5537 Posts in 1737 Topics by 1223 members
|Go to End|
12 March 2010 at 1:29pm Last edited: 12 March 2010 1:30pm
Im pretty new to SilverStripe, so excuse my ignorance but I cant figure out how to access an image ive uploaded via a custom module ive built.
Ive created the custom module and added to it an extra field in the CMS:
$fields->addFieldToTab('Root.Content.Main', new ImageField('Image','Upload Image'), 'Content');
ive also added the Image field to the has_one array:
static $has_one = array('Image' => 'File');
Now how do i call that in the .ss file? Is there a pre built function for loading in an associated image similar to $Content
or do i have to call a custom function that i build in the Controller of my module and return the image through it?
if i have to build it custom, what do i need to write in there? i dont have much of an idea..
Some help would be great.
12 March 2010 at 2:26pm
never mind, i just changed the has_one array to:
static $has_one = array('Image' => 'Image');
and called $Image in the .ss file
seems to work fine
|Go to Top|