Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » New Feature: Audio and Video

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 7 8 9 10 11 12 13 14 15 16 17 18 19
Go to End
Author Topic: 23620 Views
  • Fran
    Avatar
    Community Member
    8 Posts

    Re: New Feature: Audio and Video Link to this post

    Uncle Cheese,
    ooops...
    The VideoPage_Item extends ComplexTableField_Item should not be there. Copy-Paste mistake. I palyed with it yesterday. this is nested code...

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    Oooh.. BC.. C'est beau la-bas.. Je cherche toujours une raison de pratiquer mon francais..

    Okay, so try something like this (not guaranteed to be free of syntax errors)

    VideoPage.php

    class VideoPage extends Page
    {
    ...

    }
    class VideoPage_Controller extends Page_Controller
    {

    public function category()
    {
    if(isset($this->urlParams['ID'])) {
    // get videos with the name given in the ID param
    $videos = $this->Videos("Category = '".$this->urlParams['ID']."'");
    return $this->customise(array('Videos' => $videos))->renderWith(array('VideoPage','Page')) :
    }
    else
    // redirect to global view
    Director::redirect($this->Link());
    }

    public function CategoryTitle()
    {
    return isset($this->urlParam['ID']) ? $this->urlParam['ID'] : "All categories";
    }
    }

    VideoPage.ss

    $CategoryTitle
    <% if Videos %>
    Voici des videos...
    <% control Videos %>
    <% end_control %>

    <% else %>
    Il n'y a aucun de videos dans cette catégorie
    <% end_if %>

    Now just link to /my-video-page/category/some-category

    The one issue I suspect you'll encounter is that the category name has to be URL-safe, e.g. no spaces or special characters. That's why it's helpful to create a Category object and have the Videos relate to that rather than a string, because you can specify the category ID rather than just a title.

    Let me know how that goes!

  • Fran
    Avatar
    Community Member
    8 Posts

    Re: New Feature: Audio and Video Link to this post

    Allô MonOncle Fromage,
    P'tit train va loin.... (Québec expression meaning "we're getting there....")
    Getting better... You are absolutely right about the category object....I will work on it now...
    Tiguidou! (F_ _ _ k'n A) ... my fav slang expression I like to teach...

  • Fran
    Avatar
    Community Member
    8 Posts

    Re: New Feature: Audio and Video Link to this post

    reSalut,
    Looking good...
    In this matter, I created 1 page per category and link to videos/category/CategoryName.
    Further on, I created a CategoryPage (hidden). I wish I master enough SilverStripe and DataObject programming to feel confortable to use dynamic category instead. That will come...
    I tried refering with the tutorials and posts related to db category with no success...
    I thought I could have a dropdown list of dynamic categories with the video and have the user select right from the same page. Some kind of form need to be build. However, I do not know how to make that work to meet my need.
    Any thought?

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    You need to create a separate interface for creating categories, say, on another tab in the page edit view. Then your video page has_one Category, and in the popup for the Video object, you have a dropdown menu for CategoryID

    new DropdownField('CategoryID','Category', DataObject::get("Category")->toDropdownMap());

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: New Feature: Audio and Video Link to this post

    Hey UC I finally rebuilt my dev box and EVERYTHING is installed fresh from scratch (SS stable, DOM, SWFUpload both from SVN), also got the error logging sorted out. Here is the error I get when trying to create and AudioPage

    28-Jun-2009 07:40:31] Error at cms/code/CMSMain.php line 392: getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: New Feature: Audio and Video Link to this post

    NEVERMIND! Got some IRC support and that one's all sorted....

    My next question iiiiiiiis - how do I un-limit the file size cap? It's capped at 2Mb or 3Mb at the moment...

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    It's based on the upload_max_filesize value set in your php.ini.

    23620 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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.