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

Adding Search to Tubepress - Now You Can Too!


  • Please log in to reply
2 replies to this topic

#1 Kermit Woodall

Kermit Woodall

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 December 2010 - 01:10 PM

Hand to God - I figured out how to throw together a working search for our videos as shown in TubePress and it wasn't hard. I did have to wait for a little help from my programming partner (since I'm ignorant when it comes to JavaScript). Here's how you can do it in TubePress Pro too -- until Eric adds a better search built into TubePress.

Step 1: Make sure you have ExecPHP installed (it allows you to execute PHP within Widgets and such...)
Step 2: I added a text widget to the sidebar, titled it Video Search, and added the following code:












Step 3: Well, duh, save the Widget.
Step 4: I made a template. I won't share everything with you because you need to use your own template as a template for this. Here's the top part where I did the necessary include:

/*
Template Name: Two Column Search Template
*/
?>

include '/home/kermitwo/public_html/advocate/wp-content/plugins/tubepress_pro_2_1_2/env/pro/tubepress-pro.php';
get_header();
?>


This part is the page content area where the magic happens.

$avideosearch = $_COOKIE['avsCookie'];
print tubepressGallery('mode="tag" tagValue="advocatemag.com '.$avideosearch.'" resultsPerPage="3" playerLocation="normal"');
?>



Step 5: Profit (no wait...)
Step 6: I created a page called Video Search Results and used the template I'd created.

So what did I do here? Well in the widget we took in search terms - then saved them to a cookie. We read the cookie in the template and construct a gallery view based on those search terms. The only trick I did (since I couldn't do a gallery for a specific user AND with search terms) was make sure all our videos were tagged with the domain name and added that tag to the search string automatically.

When a user enters some search terms in the widget and clicks search they then end up a page with the videos matching their search. Nifty swifty.

When you do this for yourself you're going to have to replace the domain name with your domain and the link to the page you create. That's about it!

If you have any questions - feel free to ask. I probably can't answer them - but it never hurts to ask.

Kermit Woodall
http://kermitwoodall.com

#2 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 10 December 2010 - 07:58 PM

we took in search terms - then saved them to a cookie. We read the cookie in the template and construct a gallery view based on those search terms


Clever! And a good example of the powerful, flexible ways that you can use TubePress Pro (since it's just plain PHP).

Thanks for posting your solution - hopefully it will help others who are just as eager to get a working video search.

#3 Kermit Woodall

Kermit Woodall

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 December 2010 - 10:45 PM

Thanks for posting your solution - hopefully it will help others who are just as eager to get a working video search.



...of course I'm hoping that it might free up your time enough for you to get the description tag available for the playing video in the gallery! :D

Kermit Woodall