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.

Data Model Questions /

Page $db array


Reply


7 Posts   2227 Views

Avatar
Bambii7

Community Member, 254 Posts

13 March 2009 at 11:44am

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;
   }

Avatar
Sam

Administrator, 685 Posts

13 March 2009 at 11:55am

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.

Avatar
UncleCheese

4086 Posts

13 March 2009 at 3:31pm

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.

Avatar
Bambii7

Community Member, 254 Posts

16 March 2009 at 4:53pm

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.

Avatar
Bambii7

Community Member, 254 Posts

16 March 2009 at 4:58pm

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.

Avatar
UncleCheese

4086 Posts

16 March 2009 at 5:28pm

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

Avatar
Trym

Community Member, 18 Posts

16 March 2009 at 8:52pm

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.