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


Go to End
Reply


150 Posts   26077 Views

Avatar
Fran

Community Member, 8 Posts

23 June 2009 at 3:31am

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

Avatar
UncleCheese

Forum Moderator, 4096 Posts

23 June 2009 at 4:40am

Edited: 23/06/2009 4:41am

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!

Avatar
Fran

Community Member, 8 Posts

23 June 2009 at 5:44am

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

Avatar
Fran

Community Member, 8 Posts

23 June 2009 at 10:03am

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?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

24 June 2009 at 2:07am

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

Avatar
thrax

Community Member, 32 Posts

28 June 2009 at 9:50pm

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?

Avatar
thrax

Community Member, 32 Posts

29 June 2009 at 1:22pm

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

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 June 2009 at 2:00pm

Edited: 29/06/2009 2:01pm

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

Go to Top