Recent Topics

1 Jun 28, 2009 06:52    

My b2evolution Version: 2.x

I'm trying to get youtube's [url=http://www.google.com/uds/solutions/videosearch/index.html]AJAX VideoSearchControl[/url] to work inside posts... I get one of two results.

1) It doesn't work, I only get "loading..." which never loads.

2) It works, IFF I also have the same script in a free html widget in the sidebar, but then it only searches for the query terms from the html widget, which defeats the purpose since I can only have one set for an entire blog and can't change them by post (and then the free html block reports "loading..."

I've tried throwing it into the index and into the item_content.inc, with neither result any better. Is there something I should put into the post itself to make it work? I have all css, html, js, etc privileges set in global settings, and I get no error messages.

the code is generated by google and looks like this (less the comments they add):

  <div id="videoControl">
    <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span>
  </div>
  <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-vsw&key=ABQIAAAA6AKfHlqkwyhqdoEKURUJ8RRUzwgjBNTJXvSh6F5IwAHTZTxG6xQ8eEhwR2nbO5HSbM8majn-6AT2aA"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/css/gsearch.css");
  </style>
  <script type="text/javascript">
    window._uds_vsw_donotrepair = true;
  </script>
  <script src="http://www.google.com/uds/solutions/videosearch/gsvideosearch.js?mode=new"
    type="text/javascript"></script>
  <style type="text/css">
    @import url("http://www.google.com/uds/solutions/videosearch/gsvideosearch.css");
  </style>

  <script type="text/javascript">
    function LoadVideoSearchControl() {
      var options = {
        twoRowMode : true
      };
      var videoSearch = new GSvideoSearchControl(
                              document.getElementById("videoControl"),
                              [{ query : "mostmodernist.com"}], null, null, options);
    }
    GSearch.setOnLoadCallback(LoadVideoSearchControl);
  </script>

At this point I'll just go ahead and mention I don't know very little jacascript :oops:

2 Jun 28, 2009 09:33

Hi, I can get this to work in a post by loading the Google code as a html document using object tags. It allows for video search etc and can be sized and styled to prevent scroll bars..

<div class="videoControl">
<object data="/misc/videosearch.html" id="objectFrame" type="text/html"></object>
</div>


Saved Google code...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Video Search</title>
<!-- <link rel="stylesheet" media="all" type="text/css" href="whatever.css" /> -->
 </head>
 <body>
 <!-- ++Begin Video Search Control Wizard Generated Code++ -->
  All Your Google Script goes here
<!-- --End Video Search Control Wizard Generated Code-- -->
</body>
</html>

There may be some issues with IE, especially IE8. If you can allow iframes then you could use the following.... Note: Untested!!

<!--[if !IE]><!-->
<object data="/misc/videosearch.html" id="objectFrame" type="text/html"></object>
<!--<![endif]-->
<!--[if lte IE 8]>
<iframe src="/misc/videosearch.html" id="objectFrame" type="text/html" frameborder="0"></iframe>
<![endif]-->

Good luck

3 Jun 28, 2009 09:58

BIG thanks! I'm going to try this right now. brb.

4 Jun 28, 2009 10:27

GREAT! It works. Thank you!

Question:

Is there a way to control the video search (queries) inside the html doc via the post content? That way I can change the search query on a per post basis rather than having multiple html docs... Or even some way to change it based on the post itself from within the one html doc? some kind of call and response...

for instance, the naive method I just tried was to put

<?php $Item->title(); ?>

in the search query of the google script inside the html doc, so that the post title would serve as the search query.

it failed. what can i say, i'm running on instinct.

6 Jun 28, 2009 11:41

no big deal. you solved the big deal. thanks again.

7 Jun 28, 2009 11:59

Post Tags would be the perfect thing to feed into that search query

<?php
		// List all tags attached to this post:
		$Item->tags( array(
				'before' =>         ' ',
				'after' =>          ' ',
				'separator' =>      ', ',
			) );
	?>

8 Jun 28, 2009 12:33

yeah it would but I can't figure out how to get the php to talk to the javascript :(

unless maybe calling the script through a .php page instead of an html?

my feeling, tho, is that it would require some js, or, as you mentioned, some slick tricks from a b2 vet *cough*

8|


Form is loading...