Beste CriminalsLeden,
Ik ben nog altijd bezig met mijn YouTube Script voor mijn Portfolio.
Inmiddels ben ik zover dat hij ingebouwd is en (enigszins) naar behoren werkt.
Het klikken op andere filmpjes etc werkt allemaal prima:
http://mlormans.com/filmpjes.html
Echter als je op een video klikt om deze te bekijken herlaad hij de pagina (geen probleem)
maar dan herlaad hij ook het Header gedeelte van me website.
Hier volgt het javascript wat dit alles moet regelen:
PHP
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Demos
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @fileoverview Provides functions for browsing and searching YouTube
* data API feeds using a PHP backend powered by the Zend_Gdata component
* of the Zend Framework.
*/
/**
* provides namespacing for the YouTube Video Browser PHP version (ytvbp)
*/
var ytvbp = {};
/**
* container div id used to hold the video player
* @type String
*/
ytvbp.VIDEO_PLAYER_DIV = 'videoPlayer';
/**
* Sends an AJAX request to the server to retrieve a list of videos or
* the video player/metadata. Sends the request to the specified filePath
* on the same host, passing the specified params, and filling the specified
* resultDivName with the resutls upon success.
* @param {String} filePath The path to which the request should be sent
* @param {String} params The URL encoded POST params
* @param {String} resultDivName The name of the DIV used to hold the results
*/
ytvbp.sendRequest = function(filePath, params, resultDivName) {
if (window.XMLHttpRequest) {
var xmlhr = new XMLHttpRequest();
} else {
var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}
xmlhr.open('POST', filePath, true);
xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhr.onreadystatechange = function() {
var resultDiv = document.getElementById(resultDivName);
if (xmlhr.readyState == 1) {
resultDiv.innerHTML = '<b>Loading...</b>';
} else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
if (xmlhr.responseText) {
resultDiv.innerHTML = xmlhr.responseText;
}
} else if (xmlhr.readyState == 4) {
alert('Invalid response received - Status: ' + xmlhr.status);
}
}
xmlhr.send(params);
}
/**
* Uses ytvbp.sendRequest to display a YT video player and metadata for the
* specified video ID.
* @param {String} videoId The ID of the YouTube video to show
*/
ytvbp.presentVideo = function(videoId) {
var params = 'queryType=show_video&videoId=' + videoId;
var filePath = 'movies.php';
ytvbp.sendRequest(filePath, params, ytvbp.VIDEO_PLAYER_DIV);
}
Toon Meer
Ikzelf denk dat het hem in de: ytvbp.sendRequest functie zit.
Echter heb ik 0,0 verstand van javascript. Vandaar hier de vraag of iemand even zo aardig zou kunnen/willen zijn om dit (proberen) op te lossen.