Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObjectManager : <% sprintf(....) %> displayed on the website

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6
Go to End
Author Topic: 8332 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Sure..

    $f->removeByName('SWF');

    and you can remove requirements in the init() function of your subclass

    Requirements::block("some_requirement.js");

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Sweet.... THANK_YOU

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    I have this working rather nicely right now (from my humble point of view)
    I have created a subclass of SlideshowProPage called SlideshowPage
    taken out a couple unneeded attributes and added calls to a couple different templates depending on the player used (copies of you XML method really)
    I am working on setting up the page template right now, although I may not use it...

    I am wondering 2 things.. Do you see any future problems with this approach? (I would like to have it require little maintenance for upgrades) and Is there a way to tell SlideshowProPage not to be listed in the pagetypes available?

    sorry, 1 other thing.. is it possible to extend SlideshowProPage to allow SWF and FLV files? My slideshow player supports them and that would be very cool.

    thanks.

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    To hide the parent page use

    static $hide_ancestor = "SlideshowProPage";

    FLV is entirely possible. You would just have to change the ImageGalleryManager field to a standard FileDataObjectManager. If you have FFMPEG installed, FileDOM will encode and thumbnail video uploads on the fly.

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Very cool... I'm getting excited.

    I am learning so much with this... ;)

    I have the page type removed... who knew that would be so easy.

    I am a little lost about the next change though since that is in the grandparent of the class that I am working with right now.

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Yeah, that's definitely tricky. Start with $fields->removeByName('GalleryImages'); (I think that's the relationship managed by ImageGalleryManager.. check ImageGalleryPage.php..

    Then,

    $fiends->addFieldToTab(... new FileDataObjectManager($this,'GalleryImages'... etc));

    It will definitely take some programming chops, but it seems like you're well on your way. Good job with the subclassing and keeping the changes insulated from the core. That's the beauty of the Silverstripe framework. Takes a little extra time, but it's so much cleaner.

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    OK, I'm getting way lost here... So far based on going through the ImageGallery code and SlideShowPro code this is what I have..

          $f->removeByName('GalleryItems');
          
          $FLVvideo = new FileDataObjectManager($this,
             'GalleryImages', // Source from ImageGalleryPage.php
             'ImageGalleryItem', // class from ImageGalleryItem.php
             'FLVattachment', // File name on DataObject
             array(
                'Caption' => 'Caption',
                'ImageGalleryPage' => 'ImageGalleryPage',
                'Album' => 'Album'),
             'getCMSFields_forPopup'
          );
          
          $f->addFieldToTab("Root.Content.SWF", new FileDataObjectManager($this,$FLVvideo);

    I assume that FLVattachment is taking the place of the previous file relation?
    Not sure I have the either of the Class or Source references correct, although they do look to be correct from what I found in your source. Do I have any other syntax error?? I'm getting a syntax/parse error/ class exists ()

    I'm trying to use the example here: http://doc.silverstripe.org/doku.php?id=modules:dataobjectmanager

    I may need to step back a bit and try some samples from scratch.

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Yeah, the more I look at it, it seems like it would take more time to reverse engineer the thing into submission than it would to just build it from the ground up. ImageGallery gives you a lot of things you don't need, and you're just going to waste your time fighting with it.

    I would just start with a page with a FileDOM .. use setAllowedFileTypes() to include all image extensions, and video extensions..

    Then basically replicate the xml() function to give SSP a feed that it will like..

    When looping through your images in the XML template, you could do something like

    <% if ClassName = Image %>
    <xml tag for image />
    <% else_if ClassName = FLV %>
    <xml tag for flv /> use $FLVLink to get the link to the encoded FLV
    <% end_if %>

    8332 Views
Page: 1 2 3 4 5 6
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.