Interactive Searching

TubePress provides an end-to-end, fully customizable solution for allowing your users to interactively search YouTube or Vimeo, all without leaving your website. The image below is a simple example showing an interactive search input along with a few results.

Like everything else with TubePress, interactive searching has loads of options and is fully customizable to suit your needs. To use the feature, you’ll need two invocations of TubePress on the page:

  • Once for displaying the search input and
     
  • Once more for displaying the user’s search results
     

Let’s go over each invocation in detail.

Search Input

Displaying a search input box and button is very easy with TubePress:

print TubePressPro::getHTML('output="searchInput"');

By default, the search form will submit back to the same page and TubePress will handle the submission. If you want the results to show up on another page, just set searchResultsUrl. Please note that most users shouldn’t need to do this.

print TubePressPro::getHTML('output="searchInput" searchResultsUrl="http://mysite.com/videos.php"');

Now that you have a search input form, you’ll need to invoke TubePress somewhere else to display the search results.

Search Results

Displaying search results is also easy. Add the following code wherever on the page you’d like the search results to show up:

print TubePressPro::getHTML('output="searchResults" searchProvider="vimeo"');

The searchProvider option can be set to either youtube or vimeo, and this determines if the gallery will display YouTube videos or Vimeo videos. TubePress will also display a placeholder gallery if the user isn’t searching (e.g. on their first visit to the page), but you can make it invisible until it has search results by setting searchResultsOnly to true:

print TubePressPro::getHTML('output="searchResults" searchProvider="youtube" searchResultsOnly="true"');

Ajax-Enabled Interactive Search

With TubePress Pro, you can display search results asynchronously (i.e. without a full page load). It’s also a bit easier to set up than standard searching because you only need to invoke TubePress once on the page. The only catch is you also have to identify the DOM element where you want the search results to show up:

print TubePressPro::getHTML('output="ajaxSearchInput" searchResultsDomId="#somediv" searchProvider="vimeo"');

For the searchResultsDomId option value, just use any jQuery selector that uniquely identifies an existing DOM element on the page that can accept HTML.

Narrowing Down Search Results

By default, TubePress will search all of YouTube or Vimeo for the user's search terms. If you'd like to narrow the results down to videos uploaded by a particular YouTube Channel/User or Vimeo user, you can utilize the searchResultsRestrictedToUser option.

For instance, to restrict search results to YouTube videos uploaded by the YouTube channel comedycentral, you might use the following shortcode:

print TubePressPro::getHTML('output="searchResults" searchProvider="youtube" searchResultsOnly="true" searchResultsRestrictedToUser="comedycentral"');
Due to restrictions on YouTube and Vimeo's end, this is the only filter available to TubePress. In other words, it's not possible to limit search results to a particular playlist, album, or gallery.


Last Updated Oct 05, 2015 03:42PM PDT
c65861bf7a72e1a8878bdf73cabbbdbf@tubepress.desk-mail.com
http://assets1.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete