Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Assigning Links to rotating pics

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 613 Views
  • jparks
    Avatar
    Community Member
    7 Posts

    Assigning Links to rotating pics Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Assigning Links to rotating pics Link to this post

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

  • jparks
    Avatar
    Community Member
    7 Posts

    Re: Assigning Links to rotating pics Link to this post

    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!

    613 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.