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   4817 Views

Avatar
monsieurk

Community Member, 4 Posts

20 August 2010 at 3:34am

Edited: 20/08/2010 3:34am

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

Forum Moderator, 4096 Posts

20 August 2010 at 4:19am

Can I see your code?

Avatar
monsieurk

Community Member, 4 Posts

20 August 2010 at 4:28am

Edited: 20/08/2010 4:29am

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

Forum Moderator, 4096 Posts

20 August 2010 at 5:15am

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

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

Avatar
monsieurk

Community Member, 4 Posts

20 August 2010 at 1:39pm

Edited: 20/08/2010 2:05pm

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

Community Member, 24 Posts

20 August 2010 at 4:06pm

Edited: 20/08/2010 4:06pm

This seems potentially really helpful. Thank you for sharing.

Avatar
GRiiDWeb

Community Member, 60 Posts

19 June 2011 at 6:39am

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

Forum Moderator, 4096 Posts

20 June 2011 at 4:11am

$Player(width,height)