PHP Classes

File: load_videos.php

Recommend this page to a friend!
  Classes of José Augusto Ferreira Franco   myYouYube   load_videos.php   Download  
File: load_videos.php
Role: Example script
Content type: text/plain
Description: Example of how to load videos
Class: myYouYube
Manage and display videos from YouTube
Author: By
Last change: minor fix on #ref 003
Date: 15 years ago
Size: 4,753 bytes
 

Contents

Class file image Download

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function GetFull(){
info = confirm('This add-in is only available on full version ! ');
if(info){window.open('http://www.revista-php.net','_blank')}
    else{return false;}
}
</script>
<title>myYoutube video system with PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.subject{
background: url(subject.gif) no-repeat left top;
padding: 7px;
border: none;
width: 250px;
}
.rate{
background: url(rate.gif) no-repeat left top;
padding: 7px;
border: none;
width: 50px;
}

.msg{
background: url(message.gif) no-repeat left top;
padding: 7px;
border: none;
width: 260px;
heigth:140;
}
.send{
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent url(send.gif) no-repeat center top;
}
</style>
</head>

<?php
/*******************************************************************************
     Package : myYouTube - An simple way to display YouTube videos on your web sites
     File : load_videos.php - allows to load videos from database
     Author: José Augusto Ferreira Franco
     Nick name : Guto Ferreira
     Web : www.revista-php.net
     Build date: 27- January 2008
     Version : 1.0
     Lisence : Artist License (means you must leave this header always)
    ********************************************************************************/
// loads main class
require_once("myYouTube.class.php");
require(
"myYouTube.config.php");

?>
<body>
<?php

$Video
->width = (425/1.25); // set video width
$Video->height = (325/1.25); // set video height





$page = basename(__FILE__)."";
$rs3 = mysql_query("SELECT * FROM youtube");
$numRows = mysql_num_rows($rs3);
 
$rs = mysql_query("SELECT MIN(id) FROM youtube ");
 (int)
$minID = mysql_result($rs,0,"MIN(id)");
 
$next = $minID;

if(!isset(
$_GET["video"])){


 
 
$rs2 = mysql_query("SELECT name FROM youtube WHERE id='$minID '");
 
 
$row = mysql_fetch_object($rs2);
 
$Video->videoName = $row->name; // movie to be loaded
$Video->setVideo();
$id = $Video->getID();




$myVideo = "<fieldset>"; // loads target video
$myVideo .= "<b>Video name </b>";

$myVideo .= $Video->getVideoName().""; // video name
$myVideo .= "<p></p>";
$myVideo .= "".$Video->getVideo(); // the video himself
$myVideo .= "<p></p>";
$myVideo .= "<b>Comments </b>".$Video->getComments().""; // video comments
$myVideo .= "<p></p>";
$myVideo .= "<b>Rate </b>".$Video->getRate().""; // video rate
$myVideo .= "</fieldset>";
for(
$x = 0;$x <$numRows;$x++){ // builds navegation links
$myVideo .= " <a style='border:none;color:navy;text-decoration:none;' href='$page?video=".($next++)."'> &nbsp;&nbsp; <b> ".($x+1)." </b> &nbsp;&nbsp </a>";
}
print
$myVideo;


(!isset(
$_GET["video"])) ? ($video=1) :($video=$_GET["video"]);
return;
#ref 003
 
}
 
 else{
$id = $_GET["video"];
$currVideo = $Video->getByID($id);

$Video->videoName = $currVideo->name;
$Video->setVideo();



$myVideo = "<fieldset>"; // loads target video
$myVideo .= "<b>Video name </b>";
$myVideo .= $Video->getVideoName().""; // video name
$myVideo .= "<p></p>";
$myVideo .= "".$Video->getVideo(); // the video himself
$myVideo .= "<p></p>";
$myVideo .= "<b>Comments </b>".$Video->getComments().""; // video comments
$myVideo .= "<p></p>";
$myVideo .= "<b>Rate </b>".$Video->getRate().""; // video rate
$myVideo .= "</fieldset>";


for(
$x = 0;$x <$numRows;$x++){ // builds navegation links
$myVideo .= " <a style='border:none;color:navy;text-decoration:none;' href='$page?video=".($next++)."'> &nbsp;&nbsp <b> ".($x+1)." </b> &nbsp;&nbsp </a>";
}
print
$myVideo;

 }
 
 

 
 
echo
"<br><font color=\"red\"><b>Add and see live comments is a functionality available on full version</b></font> ";
///////////////////////NEW ADD on 1 January 2007 (only available on full version )
/*
require_once("comments.class.php");
$Com = new Comments();
$Com->getComments();
*/
$self=null;
$formT = "<form action=\"$self\" method=\"post\">";
$formT .= "<br><label>Subject </label><br>";
$formT .= "<input type='text' maxlength='30' name='subject' class='subject'>";
$formT .= "<br><label>Rate </label><br>";
$formT .= "<input type='text' maxlength='4' name='rate' class='rate'>";
$formT .= "<br>";
$formT .= "<textarea maxlength='20' class=\"msg\" name=\"msg\" rows=\"6\" cols=\"4\"></textarea>";
$formT .= "<br>";
$formT .= "<input type=\"image\" src=\"send.gif\" onClick=\"return GetFull()\">";
$formT .= "</form>";
echo
$formT;

?>

<p>&nbsp;</p>
</body>
</html>