Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Creating a video / audio page

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 3733 Views
  • WittySmitty
    Avatar
    Community Member
    4 Posts

    Creating a video / audio page Link to this post

    I am a Newbie with Silverstripe - so far I am very impressed with the modular design and the ease of site construction. I am developing a website for my church.

    I am currently running this effort on my laptop (WAMPsever) and I have successfully install many of the modules and widgets that I need. But I am not sure what would be the correct module for posting a list of either audio or video files for the end user to download.

    I plan to post a list of church services (both audio and video) for download. What is the best way to setup such a page in SS? What module do I use? Thanks.

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Creating a video / audio page Link to this post

    Hi there, Welcome to SS.

    I have recently done a similar thing with my churches website(still in development), we have the weekly sermons recorded (audio only) and posted to the site http://www.dcbc.co.nz/ss/messages.

    I used the dataobjectmanager module which has built in support for Mp3's where you can do something similar to:

    <% control Messages %>$Player<% end_control %>


    To include the flash player on your site.

    I created a dataobject for each message where the title and speaker etc are entered and the mp3 uploaded and these are managed in a FileDataObjectManager within a message page.

    If you haven't run through the tutorials then they are always the best place to start and if you want to have a look at the code for the page I mentioned above let me know and I'll post it.

    Hope it goes well

  • WittySmitty
    Avatar
    Community Member
    4 Posts

    Re: Creating a video / audio page Link to this post

    Thanks for the info. I will try the DataObjectManager a try.

    I looked at your church website that you provided - very nice and clean. Now I have additional questions

    - Did you create your own theme template or modify an existing theme?

    - What module did you use on your home page for the flash photo gallery? I like the slow zoom / pan effect.

    I am putting this for our church - which is also Baptist (Southeast Baptist Tabernacle, Indianapolis, IN). Thanks so much for you time and help. I will go over the tutorial again and again - I am a slow learner.

    -Rick Smith

  • NARKOZ
    Avatar
    Community Member
    25 Posts

    Re: Creating a video / audio page Link to this post

    if you want to have a look at the code for the page I mentioned above let me know and I'll post it

    May I look to your code for this pages? Thanks.

  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: Creating a video / audio page Link to this post

    I would love to know how you put your page together for the sermons...and if you used a module to list each message and have the pagination also.

    I was thinking about using the calendar module and modify that so that the client can just load new messages right from the cms...i

    I'd like to know how you did it...if you don't mind.

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Creating a video / audio page Link to this post

    Hey guys,

    Sorry for the delay, I forgot to subscribe to this thread so didn't see your questions. Firstly:
    Did you create your own theme template or modify an existing theme?
    - No theme for that site just created it from scratch.
    What module did you use on your home page for the flash photo gallery?
    - That's not a module that's actually done in flash then just displayed as a .swf, I'm planning on redoing it in javascript but not a huge priority.

    As to the more general questions about how I did it I won't post my actual code as it gets kinda tricky with the ajax, RSS and speaker selection but I'll post some code which will achieve the same effect but without the ajax, RSS and speaker dropdown menu.

    I didn't use a module for the frontend, the objects are managed with the DataObjectManager module, this includes the flash player I put in the table. I am planning to post a couple of tutorials covering what all this means on the www.ssbits.com website but I've got exams this week so it'll have to wait sorry. But basically it consists of two php files, Message.php and MessagePage.php, then a MessagePage.ss template file.

    This has pagination built into it but there is a good step by step of what that part of the code means here http://doc.silverstripe.org/doku.php?id=private:recipes:pagination

    If you have any questions just ask (I'll subscribe this time) but otherwise this should pretty much just work

    Cheers,
    Howard

    mysite/code/Message.php

    <?php

    class Message extends DataObject
    {
       static $db = array (
          'Title' => 'Varchar',
          'Speaker' => 'Varchar',
          'Date' => 'Date',
          'Duration' => 'Varchar'
       );
       
       static $has_one = array (
          'Attachment' => 'File',
          'MessagePage' => 'MessagePage'

       );

       public function getCMSFields_forPopup()
       {
          return new FieldSet(
             new TextField('Title'),
             new TextField('Speaker'),
             new TextField('Duration','Duration: (MM:SS)'),
             new DatePickerField('Date'),
             new FileIFrameField('Attachment')
          );
       }
       
       function Link(){
          return $this->Attachment()->Filename;
       }
    }

    ?>


    /mysite/MessagePage.php

    <?php

    class MessagePage extends Page {
       
       static $has_many = array (
          'Messages' => 'Message'
       );
       
       static $icon = 'mysite/images/icons/messages';
       
       public function getCMSFields()
       {
          $f = parent::getCMSFields();
          
          $manager = new FileDataObjectManager(
             $this, // Controller
             'Messages',
             'Message', // Source class
             'Attachment', // File name on DataObject
             array(
                'Title' => 'Title',
                'Speaker' => 'Speaker'
             ), // Headings
             'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
             // Filter clause
             // Sort clause
             // Join clause
          );

          $manager->setUploadFolder('/Messages/');
          
          $f->addFieldToTab("Root.Content.Messages", $manager);
          
          return $f;
          
       }
    }

    class MessagePage_Controller extends Page_Controller {

       function orderedMessages(){
          //
          // Change this to set the limit of messages displayed on each page //
          //
          $messageLimit = 10;
       
          if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
          $SQL_start = (int)$_GET['start'];
          $doSet = DataObject::get(
             $callerClass = "Message",
             $filter = "MessagePageID = $this->ID",
             $sort = "Date DESC",
             $join = "",
             $limit = "{$SQL_start},$messageLimit"
          );
       return $doSet ? $doSet : false;
       }

    }

    ?>


    /themes/mytheme/Layout/templates/MessagePage.ss

    <!-- Main right column -->
          $Content
          <table id="messages">
          <% control orderedMessages %>
             <tr class="$EvenOdd $FirstLast">
                <td class="message-date">$Date.Nice</td>
                <td class="message-title">$Title<br />$Speaker <% if Duration %><span class="duration">($Duration mins)</span><% end_if %></td>
                <% control Attachment %>
                   <td class="message-download"><a href="$Link">Download</a></td>
                   <td class="message-playnow">Play now:</td>
                   <td class="message-player">$Player</td>
                <% end_control %>
             </tr>
          <% end_control %>
          </table>
          
          <% if orderedMessages.MoreThanOnePage %>
             <p id="pagination-links">
                <% if orderedMessages.NotFirstPage %>
                   <a href="$orderedMessages.PrevLink" class="ajax" title="Previous Page">&lt;&lt; Prev</a> |
                <% end_if %>
                
                <% control orderedMessages.Pages %>
                   <% if CurrentBool %>
                      <strong>$PageNum</strong>
                   <% else %>
                      <a href="$Link" class="ajax" title="Go to page $PageNum">$PageNum</a>
                   <% end_if %>
                <% end_control %>
                
                <% if orderedMessages.NotLastPage %>
                   | <a href="$orderedMessages.NextLink" class="ajax" title="Next Page">Next &gt;&gt;</a>
                <% end_if %>

             </p>
          <% end_if %>
          <!-- end Middle column -->

  • WittySmitty
    Avatar
    Community Member
    4 Posts

    Re: Creating a video / audio page Link to this post

    Thanks for the additional information (it will take me a few days to digest all this). I look foward to reading your tutorial on ssbits.com

    Again, thanks for the help.

    -WittySmittty

  • dreezy
    Avatar
    Community Member
    9 Posts

    Re: Creating a video / audio page Link to this post

    howard,

    the website of the church looks good.

    I always making a site of our church and want to place also our recordings on these site.

    But i've copied your code into the right files/folders.

    But when i goto the CMS i see a Messagepage to make, when i make this page, i got an error

    it says:

    "There has been an error". Nice error i think...

    So i think its in the file "messagepage.php", but i can't find it.

    Maybe you have a solution?

    GreetX DreeZy

    ------------------------------

    I try to type some english, but it is not very good i know.

    3733 Views
Page: 1 2
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.