Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Assigning Links to rotating pics


Go to End


3 Posts   1125 Views

Avatar
jparks

Community Member, 7 Posts

20 August 2010 at 6:28pm

OK, well this is part two ... The pics are rotating and using the DOM people can log in and add their banners. I have added another field to the DOM that allows people to add an URL

-------------------
<?php
class Banner extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'URL' => 'Text'
);

static $has_one = array (
'Attachment' => 'Image',
'BannerPage' => 'BannerPage'
);

public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextField('URL'),
new TextareaField('Description'),
new FileIFrameField('Attachment')
);
}
}
?>

I am using this function to call the pics

public function Banners() {
$folder = Folder::findOrMake("Uploads");
return DataObject::get("Image", "ParentID = $folder->ID");
}

Thank you Uncle

What is the best way to attribute the URL value to the image?

Thank you for your help!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2010 at 1:52am

That looks right to me. What is giving you trouble?

Avatar
jparks

Community Member, 7 Posts

21 August 2010 at 3:10am


What is the best way to attribute the URL value to the image?

When a user goes into the DOM and adds a Banner they can input a url ... I want that url to be attached to the pic so when the Banner is displayed on the homepage you can click on the pic and be taken to that advertiser's website.

Thank you for your help!