Jump to:

7935 Posts in 1536 Topics by 943 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, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5
Go to End
Author Topic: 4426 Views
  • monsieurk
    Avatar
    Community Member
    4 Posts

    Re: video not showing in the pages Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: video not showing in the pages Link to this post

    Can I see your code?

  • monsieurk
    Avatar
    Community Member
    4 Posts

    Re: video not showing in the pages Link to this post

    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,

  • UncleCheese
    Avatar
    4085 Posts

    Re: video not showing in the pages Link to this post

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

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

  • monsieurk
    Avatar
    Community Member
    4 Posts

    Re: video not showing in the pages Link to this post

    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.

  • tonito
    Avatar
    Community Member
    24 Posts

    Re: video not showing in the pages Link to this post

    This seems potentially really helpful. Thank you for sharing.

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: video not showing in the pages Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: video not showing in the pages Link to this post

    $Player(width,height)

    4426 Views
Page: 1 2 3 4 5
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.