Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

Using Tubepress and Shadowbox to display list of Youtube IDs


  • Please log in to reply
8 replies to this topic

#1 Brian Murphy

Brian Murphy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 25 August 2011 - 08:56 AM

Hi Eric,

What I would like to do is have a Wordpress Page where I use the page title as a search parameter for a seperate MySQL database of videos I have.

I'd like to display the search results using Tubepress. Ideally I'd like to pass an array of Youtube IDs to Tubepress to output, but failing that is there is a suitable loop I could use that outputs Tubepress like code.
I've had a go of doing that myself and while the results display, they don't play when clicked using Shadowbox. Kind of a similar bug to what I had when I upgraded to 2.2.7

If you have any advice that would be great,
thanks

#2 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 26 August 2011 - 11:19 AM

Hi,

There's a ticket in for specifically this functionality, but in the meantime (as you discovered) there's no particularly easy way to accomplish this. The under-the-hood logic quickly gets complex.

failing that is there is a suitable loop I could use that outputs Tubepress like code


Could you elaborate a little more on what you mean? If I understand you correctly, you're wondering if there's an HTML template that you can loop over to spit out code similar to what TubePress generates?

#3 Brian Murphy

Brian Murphy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 26 August 2011 - 12:37 PM

Hi Eric,

What I tried to do is copy a set of HTML from a successfully generated gallery and then modify the variables to my results set. This is the main loop below I have the gallery container code in there also.

while($row = mysql_fetch_array($result))
                  {
                  echo "<div class=\"tubepress_thumb\">";
                  echo "<a id=\"tubepress_image_I-". $row['YoutubeID'] . "_1165638837\" rel=\"tubepress_youtube_shadowbox_1165638837\">";
                  echo "<img alt=\"DEFAULT TEXT\" src=\"http://i.ytimg.com/vi/". $row['YoutubeID'] . "/hqdefault.jpg\" height=\"90\" width=\"120\">";                   echo "</a>";
		echo "</div>";
                  }
                echo "</div></div.";

What results from this is what looks like a successful gallery but when the images are clicked, Shadowbox launches with no content. Any idea what could cause that? Also what is the random number - In this instance 1165638837 - is it necessary?

Thanks

#4 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 27 August 2011 - 09:38 PM

The piece that you're missing is the small block of JavaScript that sits below the HTML for any TubePress gallery. e.g.

<script type="text/javascript">
	TubePressGallery.init(482454653, {
		ajaxPagination: true,
		fluidThumbs: true,
		shortcode: "%5Btubepress%20galleryId%3D%22482454653%22%5D",
		playerLocationName: "normal",
		embeddedHeight: "355",
		embeddedWidth: "575",
		themeCSS: ""
    });
</script>
This basically wires up each gallery's thumbnails. So in your case you'll need to add a block like this below your HTML-generation loop. Make the random number in the HTML the same as the first argument to TubePressGallery.init(). So you'll want to have something along the lines of:

<script type="text/javascript">
	TubePressGallery.init(1165638837, {
		ajaxPagination: true,
		fluidThumbs: true,
		shortcode: "%5Btubepres%5D",
		playerLocationName: "shadowbox",
		embeddedHeight: "355",
		embeddedWidth: "575",
		themeCSS: ""
    });
</script>
This isn't really documented anywhere because it's really meant to be internal to TubePress's implementation, but it should work for you..

#5 Brian Murphy

Brian Murphy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 29 August 2011 - 08:16 AM

Thanks Eric,

No luck with it I'm afraid. I thought the javascript shortcode lacked an 's' in tubepress but that didn't fix it. I'm actually using a hardcoded value rather than a random number, in this case 1165638837. Would this affect it working, why is this number needed?

It's obviously something small as I can get a tubepress to work on my wordpress template page. I can get the query to execute and the thumbnails to be displayed and launch shadowbox, it's just that shadowbox is not getting the Videos sent to it.

#6 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 31 August 2011 - 03:34 PM

why is this number needed?


TubePress needs to be able to uniquely identify each gallery it finds in the DOM in order to support multiple galleries. It uses a random number for each gallery. This way, each gallery on the page can have independent settings. It's also needed to support certain Ajax operations such as pagination and loading up a new embedded player (after a thumbnail click).

Are you seeing any errors in Firebug? Do you have a link to your site that you can share?

#7 Brian Murphy

Brian Murphy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 07 September 2011 - 11:37 AM

Hi Eric,

Changing the fixed number to a random number didn't change it at all. Could I PM you the code perhaps? the code is not hosted at present. It has to be something very small in the way that the Youtube ID is passed to Shadowbox.

There are no errors in Firebug.

#8 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 10 September 2011 - 05:38 PM

Sure, definitely PM me the code and I'll see if I can get it running. I feel bad making you sift through all of TubePress's JS!

#9 Brian Murphy

Brian Murphy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 21 October 2011 - 05:16 AM

Hi Eric,

Did you have any luck figuring this out?
Thanks
Brian