I have never worked with PHP before, but I want to do a keyword search of 1000 videos and load the result into a flash player for a video-art project.
I know I can load a link in the player with this code:
<a href="#" onclick="jwplayer().load('http://www.projectoctober.com/clip/swamp/swamp1.mp4')">
So I tried to integrate that with some PHP code that I found (this was working but the link pointed directly to the video - so I tried adding an onclick attribute)
[php]<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load(“links.xml”);
$x = $xmlDoc->getElementsByTagName(‘item’);
$q = $_GET[“q”];
if (strlen($q) > 0) {
$hint = “”;
for ($i = 0; $i < ($x->length); $i++) {
$v = $x->item($i)->getElementsByTagName(‘title’);
$y = $x->item($i)->getElementsByTagName(‘keyword’);
$z = $x->item($i)->getElementsByTagName(‘url’);
if ($y->item(0)->nodeType == 1) {
if (stristr($y->item(0)->childNodes->item(0)->nodeValue, $q)) {
if ($hint == “”) {
$hint = “<a href=’” . “’ onclick=’“jwplayer() . load( / ’ . $z->item(0)->childNodes->item(0)->nodeValue . /’)”’>” . $v->item(0)->childNodes->item(0)->nodeValue . “”;
} else {
$hint = $hint . “
<a href=’” . “’ onclick=’“jwplayer() . load( / ’ . $z->item(0)->childNodes->item(0)->nodeValue . /’)”’>” . $v->item(0)->childNodes->item(0)->nodeValue . “”;
}
}
}
}
}
if ($hint == “”) {
$response = “no suggestion”;
} else {
$response = $hint;
}
echo $response;
?>[/php]
I keep getting errors on the first line that uses the onclick attribute. I hope it is something simple with my syntax. Any help would be great!
You can see how I am using it here http://private.projectoctober.com/swampex.html