Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Setting Up Additional Images to a Page

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1301 Views
  • brandstudio
    Avatar
    Community Member
    5 Posts

    Setting Up Additional Images to a Page Link to this post

    Hi Guys,

    Can I say first silverstripe rocks, what an awesome piece of software to work
    with!! Totally blown away.

    OK MY PROBLEM

    One of programmers set this site up sometime ago and can't remember what
    he did - It may be an additional modification he has installed ( gallery maybe )

    Anyways it works fine but currently it only allows you to add two images
    to a "project" page. I need to make this a total of 5 images.
    These images are different to the ones you can add via the main editor
    and are displayed to the left of the page content not within the $content.

    These are out putted like..

    $Photo1.SetWidth(150)
    $Photo2.SetWidth(150)

    If this gives any clues as to the modification he may have added.

    So what I need to DO....

    SEE ATTACHED IMAGE FOR REFERENCE

    FIG 2, shows the backend - I need to make this 5 images boxes instead
    of only two it currently lets you add.

    FIG 1, I then want to add another 3 images Im guess I do that simply
    $Photo1.SetWidth(150)
    $Photo2.SetWidth(150)
    $Photo3.SetWidth(150)
    $Photo4.SetWidth(150)
    $Photo5.SetWidth(150)

    Many Thanks for your help in advance.

    P.S also any suggestions or built in function to make the fullsize image popup
    if click from the front end?.. this isnt a major tho.

    Sefton

    Brandstudio

  • brandstudio
    Avatar
    Community Member
    5 Posts

    Re: Setting Up Additional Images to a Page Link to this post

    OK I found the solution myself and added this below.

    I HAD TO ADD THE ADDITIONAL 3 PHOTOS TO THE BELOW ARRAY "projectpage.php" type page not holder.

    static $has_one = array(
    'Photo1' => 'Image',
    'Photo2' => 'Image',
        'Photo3' => 'Image', <-- HERE
        'Photo4' => 'Image', <-- HERE
        'Photo5' => 'Image' <-- HERE
    );
    function getCMSFields() {
    $fields = parent::getCMSFields();

    THEN ALSO ADD ANOTHER 3 ROWS HERE

    $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
    $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo1'));
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo2'));
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo3')); <-- HERE
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo4')); <-- HERE
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo5')); <-- HERE

       
    return $fields;
    }
    }

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Setting Up Additional Images to a Page Link to this post

    That would work. Don't forget to run db/build?flush=1

    1301 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.