The Church Media Community
Equipping You to Communicate Effectively
support CMN & share a
library of 19K+ images, videos, etc
Go Pro!
 
Go Back   The Church Media Community > Website Design > Website Coding Discussions
Forgot Password?
                          Register

Website Coding Discussions PHP, MySQL, Java, Javascript, ASP, etc.

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 3 votes, 1.00 average. Display Modes
  #1 (permalink)  
Old Monday, May 2nd, 2011, 06:15 AM
New Church Media Member

 
 Join Date: May 2011 
 Last Online: Wednesday, May 9th, 2012 
Need help! PHP, media database, popup window player

Hello,
I'm quite new to coding, although graduated IT some 15 years ago, but working in graphic design area since then and never practice coding seriously. For our church website which has multimedia database I need an advice in what direction should I go and perhaps dig more into coding techniques.
Here's the situation:
I have database with info about the stored sermons (both audio & video), i.e. date, title, speaker, location, path to the clip on site, duration etc. I want to display on page the latest 5 (for instance) sermons according to date field descending as a dynamic content, which I did (using mysql database and php code). Every displayed field has an icon which is a link to open new popup window with player playing the related chosen sermon.

My problem/question is how can I pass those database-field variables of the chosen clip to the next page (popup window)? I'm using sessions to (try to) pass clip's info. I think I'm stuck because I'm using dynamic content to display the clip's info and link as a repeat region and can't figure out how to pass only the chosen (by clicking) clip's data to the new popup window. PHP code for displaying latest 5 sermons on the web page works fine, but at this moment I don't have the necessary knowledge to open the popup window player displaying and playing the correct thing. At this stage I'm concerned about the audio. The video is on vimeo and at this moment is an embedded player on the page.
Excuse me for being too long, but wanted to be more specific.

Any help will be highly appreciated! Please, give me some advice and example, if possible!
Thank you!
Reply With Quote Start a New Topic From This Comment
  #2 (permalink)  
Old Tuesday, May 10th, 2011, 02:11 PM
dmerchen's Avatar
Church Media Regular

 
 Join Date: Oct 2009 
 Last Online: Today 
You could use sessions but that makes it difficult to share a link with someone. I'd suggest making a dynamic player page, and on your index page, use the information collected from the user input to formulate specific url for the player.

Example:

http://www.domain.com/player.php?video_id=36

In your database, I assume you've some sort of PK or other unique identifier, so use that as an ID for each video. On the dynamic page just create a link pointing to the video id.

Care to share your code thus far? Shouldn't be too hard to fix you up.
Reply With Quote Start a New Topic From This Comment
  #3 (permalink)  
Old Wednesday, May 11th, 2011, 01:03 PM
New Church Media Member

 
 Join Date: May 2011 
 Last Online: Wednesday, May 9th, 2012 
Thanks a lot!
As for now, I have a working code which does exactly what I want with the query and displaying. Now I'm working on two things:
1) Pagination control - it should be for this dynamic page content, not for different html pages.
2) Search bar and several (independent) dropdowns to do query for archives (all media archives by months), preacher, location, etc.
Any ideas and suggestions?
Here's the working code (in main file media.php), in case it helps someone and for suggestions:
PHP Code:
  <table border="0">
   <?php do { ?>
     <tr>
       <td width="512" align="left" valign="top">
   <div id="message">
     <div class="graphic"><img src="_images/media_logo_50x50.jpg" width="50" height="50"  alt=""/>
     </div>
     <div class="info">
       <h4><?php echo $row_chrono['title']; ?></h4>
       <p><?php echo $row_chrono['spName']; ?></p>
         <p><?php //This part translates the day names into bulgarian ones
                 
$timestamp=strtotime($row_chrono['date']);
                 
$date=date('l, d F Y, H:i часа',$timestamp);
                 
$array1=array("Monday""Tuesday""Wednesday""Thursday""Friday""Saturday""Sunday");
                 
$array2=array("Понеделник""Вторник""Сряда""Четвъртък""Петък""Събота""Неделя");
                  
$array3=array("January""February""March""April""May""June",  "July""August""September""October""November""December");
                  
$array4=array("Януари""Февруари""Март""Април""Май""Юни",  "Юли""Август""Септември""Октомври""Ноември""Декември");
                 
                 
$date1=str_replace($array1,$array2,$date);
                 
$date2=str_replace($array3,$array4,$date1);
                 echo 
$date2;
                 
?></p>
           
         <p><?php echo $row_chrono['locName']?></p>
       </div>     <!--class = "info"-->
     
         <div id="listen"><?php
             $Track
['title'] = $row_chrono['title'];
             
$Track['speaker'] = $row_chrono['spName'];
             
$Track['location'] = $row_chrono['locName'];
             
$Track['date'] = $row_chrono['date'];
             
$Track['alink'] = $row_chrono['alink'];
             
$Track['dur_aud'] = $row_chrono['dur_aud'];
             
$_SESSION['track' .$row_chrono['id']] = $Track;
             if (
$row_chrono['has_aud'] != 0){
              print 
"<a href=\"player_au.php?track=$row_chrono[id]\"  title=\"Listen\"  onclick=\"NewWindow(this.href,'Listen','500','150','no');return  false\"><img src=\"_images/sound.png\" width=\"20\"  height=\"20\"/>";}?>
         </div>
             
 <!--        <div id="dlAudio"><?php $url =  trim($row_chrono['alink'],'<mysite>/media/audio/'); //So far I'm  not allowed posting URLs
            
print "<a  href=\"<mysite>/media/audio/download.php?file=$url\"  title=\"Download Audio\"><img src=\"_images/download.png\"  width=\"20\" height=\"20\"/>";
 
// I experience some problems with creating download link which opens "Save As" window
 
?>
         </div>  -->
           
         <div id="watch"><?php if ($row_chrono['has_vid'] != 0){
           
$Track['title'] = $row_chrono['title'];
           
$Track['vlink'] = $row_chrono['vlink'];
           
$Track['dur_vid'] = $row_chrono['dur_vid'];
           
$_SESSION['track' .$row_chrono['id']] = $Track;
            print 
"<a href=\"player_vi.php?track=$row_chrono[id]\"  title=\"Watch\"  onclick=\"NewWindow(this.href,'Watch','512','288','no');return  false\"><img src=\"_images/television.png\" width=\"20\"  height=\"20\"/>";}?>
         </div>
 
     </div> <!--message-->
       </td>
       </tr>
     <?php } while ($row_chrono mysql_fetch_assoc($chrono)); ?>  
   </table>
   <p>&nbsp;  
   <table border="0">
     <tr> <!-- Currently used pagination control. It doesn't give info of total number of pages and which number is current page -->
       <td width="30" align="left"><?php if ($pageNum_chrono 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_chrono=%d%s"$currentPage0,  $queryString_chrono); ?>"><img  src="_images/resultset_first.png" width "15" height="15"  title="First"/></a>
           <?php // Show if not first page ?></td>
       <td width="30" align="left"><?php if ($pageNum_chrono 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_chrono=%d%s"$currentPage,  max(0$pageNum_chrono 1), $queryString_chrono); ?>"><img  src="_images/resultset_previous.png" width "15" height="15"  title="Previous" /></a>
           <?php // Show if not first page ?></td>
       <td width="30" align="left"><?php if ($pageNum_chrono $totalPages_chrono) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_chrono=%d%s"$currentPage,  min($totalPages_chrono$pageNum_chrono 1), $queryString_chrono);  ?>"><img src="_images/resultset_next.png" width "15"  height="15" title="Next" /></a>
           <?php // Show if not last page ?></td>
       <td width="30" align="left"><?php if ($pageNum_chrono $totalPages_chrono) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_chrono=%d%s"$currentPage,  $totalPages_chrono$queryString_chrono); ?>"><img  src="_images/resultset_last.png" width "15" height="15" title="Last"  /></a>
           <?php // Show if not last page ?></td>
     </tr>
   </table>
I'll appreciate any suggestion, as well as critique.
Reply With Quote Start a New Topic From This Comment
  #4 (permalink)  
Old Saturday, May 21st, 2011, 12:29 PM
dmerchen's Avatar
Church Media Regular

 
 Join Date: Oct 2009 
 Last Online: Today 
Since you've already build something that works, why not just build on what you have.

You could use "offset" in SQL to create pagination, setting a limit would also help save on some resources when running potentially large queries.

SELECT column FROM table
LIMIT 10 OFFSET 5
Reply With Quote Start a New Topic From This Comment
  #5 (permalink)  
Old Wednesday, August 17th, 2011, 10:17 PM
New Church Media Member

 
 Join Date: Mar 2010 
 Last Online: Yesterday 
First, don't ever, ever make a pop up window. They're terrible. Down right terrible.

It'd be best to make a dynamic play page for instance just use a GET request with the id of the entry, then on the player page,


if(isset($_GET['var'])) {
//query the database for the video with the id given via GET and print out all the information
} else {
// return it back to the media listing page
header("Location: /mediapage");
}
Reply With Quote Start a New Topic From This Comment
  #6 (permalink)  
Old Thursday, August 18th, 2011, 01:41 PM
Bethel Sarnia

 
 Join Date: Nov 2010 
 Last Online: Today 
Don't know what kind of experience you have with jQuery or Javascript, but jQuery could appear to handle everything on the same page, while sending requests and stuff via ajax. Makes for a smoother, seemingly faster experience if you can pull it off well.
__________________
Josh Guerette
Producer - Bethel Sarnia
Reply With Quote Start a New Topic From This Comment
  #7 (permalink)  
Old Wednesday, September 21st, 2011, 12:06 PM
New Church Media Member

 
 Join Date: Sep 2011 
 Last Online: Wednesday, September 21st, 2011 
Jquery is the way to go.
Reply With Quote Start a New Topic From This Comment
Reply

  The Church Media Community > Website Design > Website Coding Discussions

Tags
database, dynamic content, php, player, popup

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:



Add to Google


Register Now for FREE!
Our records show you have not yet registered to our community. To sign up for your FREE account INSTANTLY fill out the form below!

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


All times are GMT -6. The time now is 01:11 PM.

   
 
© 1995-2008, ChurchMedia™, ChurchMedia LLC

SEO by vBSEO 3.1.0