Jump to:

3448 Posts in 1062 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Page $db array

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

Page: 1
Go to End
Author Topic: 2198 Views
  • Bambii7
    Avatar
    Community Member
    254 Posts

    Page $db array Link to this post

    Hi all, I'm still new with Silver Stripe (but loving its flexiblity soo much!).
    I'm trying to build a module to intergrate with Slide Show Pro. The first draft is still in development. All I'm trying to do is supply a drop down with availible gallerys in my slide show pro page.
    It's kind of there but keep getting errors when trying to do a DB build the cause seems to be in here

       static $db = array (
          'Gallery' => 'Enum($this->getAlbumName())'
       );

    I get the following

    Warning: Cannot modify header information - headers already sent by /sapphire/core/Debug.php on line 151

    I've been trying to resolve this on my own but frustration is building. Any pointers? I'm still very noob and don't quite have my head arround all the API

    Here is the album func

       public function getAlbumName() {
          $result = $this->dbGet();
          $tailValue = array_pop($result);
          foreach($result as $value) {
             $albumOptions .= $value.',';
          }
          $albumOptions .= $tailValue;
          return $albumOptions;
       }

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Page $db array Link to this post

    Hi Bambii,

    You can't call a method inside the enum values. Perhaps it would be better if you had a separate page type that listed your Galleries, and then did this:

    class SlideShowProPage {
    static $has_one = array(
    "Gallery" => "Gallery"
    );
    }

    Then you can use $Gallery.Title to display the Title field of the related gallery object in your database.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Page $db array Link to this post

    Also, you might want to get in touch with Josh from Silverstripe. He's been working on the Slideshow Pro module for SS. Also, see my ImageDataObjectManager or ImageGallery module for robust management and uploading of image files. You can probably build off one of those and generate an XML feed for SSP.

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Page $db array Link to this post

    Thanks for your reply Sam.
    So that explains why I'm getting an error!
    The easiest method would be to paste the gallery name into a custom page field. I was trying to make it a little simpler by creating a drop down of all availible albums. I just haven't sussed out the method yet. I will post back here once I crack it, should be too hard.

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Page $db array Link to this post

    Oh I didn't realise someone was already undertaking the SSP module, I'll try and contact him, cheers uncle cheese. I built a basic image gallery off the fileManager module. But there were issues with image stamping (shigh...) I just went for the sure win and brought a copy of Slide Show Pro. It's a very nice method to administrate images.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Page $db array Link to this post

    I've actually gone ahead and built an SSP module off the ImageGallery. Should be ready very soon.

    http://www.silverstripe.org/all-other-modules/show/256209#post256209

  • Trym
    Avatar
    Community Member
    18 Posts

    Re: Page $db array Link to this post

    Hi Uncle Cheese

    I tried to catch you on another old topic, but I think I didn't catch you.
    Can you please help me with http://silverstripe.org/customising-the-cms/show/253291?start=0#post255930

    Thanks in advance.

    Best regards Trym
    I'm sorry to disrupt this thread, but don't know how to get in touch in other ways.

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