7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » video not showing in the pages
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 3693 Views |
-
Re: video not showing in the pages

20 August 2010 at 3:34am Last edited: 20 August 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.
-
Re: video not showing in the pages

20 August 2010 at 4:28am Last edited: 20 August 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,
-
Re: video not showing in the pages

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'
); -
Re: video not showing in the pages

20 August 2010 at 1:39pm Last edited: 20 August 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. -
Re: video not showing in the pages

20 August 2010 at 4:06pm Last edited: 20 August 2010 4:06pm
This seems potentially really helpful. Thank you for sharing.
-
Re: video not showing in the pages

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
| 3693 Views | ||
| Go to Top | Next > |


