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

video not showing in the pages


Reply

33 Posts   4574 Views

Avatar
monsieurk

20 August 2010 at 3:34am (Last edited: 20 August 2010 3:34am), Community Member, 4 Posts

Hi,

I have coded the Video page and built the database with success.

I can create a Video Page and attach a FLV file.

But when I want to see it, I have a SQL error with ParentID column does not exist.

Here is the error :

[User Error] Couldn't run query : SELECT "Video"."ClassName", "Video"."Created", "Video"."LastEdited", "Video"."Title", "Video"."Description", "Video"."VideoID", "Video"."ID", CASE WHEN "Video"."ClassName" IS NOT NULL THEN "Video"."ClassName" ELSE "Video" END AS "RecordClassName" FROM "Video" WHERE ("ParentID"=xx) Unknown column 'ParentID' in 'where clause'

I have checked the db and the Video : it did not contains ParentID field.

How do I solve my problem ? (Adding a Parent in Video.php)

Currently, on SS 2.4.1.

Thanks in advance.

Avatar
UncleCheese

20 August 2010 at 4:19am 4085 Posts

Can I see your code?

Avatar
monsieurk

20 August 2010 at 4:28am (Last edited: 20 August 2010 4:29am), Community Member, 4 Posts

Sure

Video.php

<?php

class Video extends DataObject
{
static $db = array(
'Title' => 'Varchar(100)',
'Description' => 'Text'
);

static $has_one = array(
//Make sure this come first
'Video' => 'FLV'
);
}

?>

VideoPage.php

<?php

class VideoPage extends Page
{
static $has_many = array(
'Videos' => 'Video'
);

public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Videos", new FileDataObjectManager(
$this,
'Videos',
'Video',
'Video',
array('Title'=>'Title', 'Description'=>'Description'),
new FieldSet(
new TextField('Title'),
new TextareaField('Description')
)
)
);
return $fields;
}

}

class VideoPage_Controller extends Page_Controller
{
}

?>

VideoPage.ss (called byHTML 5 code)

<article class="VideoPage">
   <% control Videos %>                     
      <div class="link">
          <div class="description">
            <h3>$Title</h3>
            <p>$Description</p>
          </div>
          <div class="resource">
            <% control Video %>
               $VideoPopup(200x200, 400x400)
            <% end_control %>
          </div>
      </div>
   <% end_control %>
   <footer class="article">
      ...
   </footer>
</article>

I used most of the code Rishi posted.

Thanks for the look,

Avatar
UncleCheese

20 August 2010 at 5:15am 4085 Posts

Your video object isn't reciprocating the $has_many relationship to VideoPage.

$has_one = array (
'Video' => 'FLV',
'VideoPage' => 'VideoPage'
);

Avatar
monsieurk

20 August 2010 at 1:39pm (Last edited: 20 August 2010 2:05pm), Community Member, 4 Posts

My bad...

I misread the code put by Rishi (did not see the 'VideoPage' => 'VideoPage').

Thanks for the info and the time.

Now, have an error with GD.php and getimasesize(), i will check on the forums.

Update
Found that my generate videos thumbnails was an empty/corrupted image file.
Had replaced the image and it works fine.

Avatar
tonito

20 August 2010 at 4:06pm (Last edited: 20 August 2010 4:06pm), Community Member, 24 Posts

This seems potentially really helpful. Thank you for sharing.

Avatar
GRiiDWeb

19 June 2011 at 6:39am Community Member, 60 Posts

Hi,
I'd like to change and embed the video in the page, rather than have the pop up.
There was a line of code to use rather than $VideoPopup(160x160, 500x400) for this to happen, but I can't find it in my files anywhere.
Can anyone remind me of what to add / change please or do I have a false memory that it existed?

Many thanks
GW

Avatar
UncleCheese

20 June 2011 at 4:11am 4085 Posts

$Player(width,height)