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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

New Feature: Audio and Video


150 Posts   24932 Views


23 June 2009 at 3:31am Community Member, 8 Posts

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


23 June 2009 at 4:40am (Last edited: 23 June 2009 4:41am), 4085 Posts

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)


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')) :
// redirect to global view

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

<% 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!


23 June 2009 at 5:44am Community Member, 8 Posts

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


23 June 2009 at 10:03am Community Member, 8 Posts

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?


24 June 2009 at 2:07am 4085 Posts

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());


28 June 2009 at 9:50pm Community Member, 32 Posts

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?


29 June 2009 at 1:22pm Community Member, 32 Posts

NEVERMIND! :D 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...


29 June 2009 at 2:00pm (Last edited: 29 June 2009 2:01pm), 4085 Posts

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