This is topic JavaScript Query String help request in forum Officers' Lounge at Flare Sci-Fi Forums.


To visit this topic, use this URL:
https://flare.solareclipse.net/ultimatebb.php/topic/10/3986.html

Posted by bX (Member # 419) on :
 
Is there a JavaScript guru in the house?

I'm updating my website and in so doing, giving the portfolio a Flash interface. Unfortunately Flash sucks donkey at displaying, say, movies, so I want to be able to pop-up windows to display movies and higher-rez images. And the method I want to do this uses the GET method to pass the URL of the content in question to an HTML (or PHP) document template which would then parse the Query String to display the correct content.

So I can get Flash to spit out, say:

http://www.furioso.com/test/video_display.php?moviefile=video%2FDick2%2DTrailer%2D300Kbps%2Emp4

but then I don't know how to make the video_display.php file to display the correct content.

I'll probably make a separate template for JPGs, but I'm guessing the code would be similar. Any help would be greatly appreciated.
 
Posted by Cartman (Member # 256) on :
 
*scratches head*

Waitwaitwaitwaitwait, you want to write a pure PHP-script to display video files a la YouTube? Even though YT (and indeed almost every other video-sharing portal) itself uses embedded Flash because trying to do anything video in PHP is sheer madness? Or am I misinterpreting your intentions?
 
Posted by Jason Abbadon (Member # 882) on :
 
You could just post all your video on Y-Tube and hotlink it- just to be an ass, of course.
 
Posted by Charles Capps (Member # 9) on :
 
... if you're going to pass a query string to the PHP file to begin with, why do you want to use Javascript alone to write the URL and what have you?

Overcomplicated.

But if you insist, you can find the query string as: document.location.search

You'll still need to parse it, of course.

Or are you asking how to use PHP to read the query string? If so, you must learn PHP. Or the simple answer is to look in $_GET, but learning all the side effects would be smarter.
 
Posted by bX (Member # 419) on :
 
Sorry, I guess I wasn't clear. This is all a bit over my head I'm afraid. Anyway I think I've got it sorted. What I needed was the "document.write" syntax. (I should put in a JS switch to detect whether a visitor has the QuickTime plugin.)

Such that (so long as you have QuickTime installed) this:

http://www.furioso.com/test/display_video.html?SpinozaFlyby_MPG400.mp4

works now. For those uncomfortable with the View Source option, basically there's a JavaScript function at the top of the "display_video.html" page which puts everything in the URL after the question mark into a variable. (An admittedly more elegant solution would be to parse different variables out of the document.location.search string.) Meanwhile partway down the page, document.write adds an embed tag with the URL of the content to be displayed.

So this:

http://www.furioso.com/test/display_video.html?SadGirl_MPG400.mp4

will work.

For those too proud to install QT, how do you play back MP4 content and for what plugin would I need to look up player embed tags?

The rough version (in Flash which throws the html files as popups using JS) is visitable at:

http://www.furioso.com/test/test.html

in the examples section.
 


© 1999-2024 Charles Capps

Powered by UBB.classic™ 6.7.3