Jump to content

Newbie Navigation


dub_beat

Recommended Posts

Hi all,

 

I'm guessing that what I'm about to ask is the ABC's of PHP / web programming. I come from a mainly flash background and don't have much PHP examples/ experience to draw on.

 

What I'm trying to do is conceptually simple.

 

I have a div with thumbnails of video clips and another div of a flash video player.

 

 

Each thumbnail will have a videoID variable assigned to it.

 

All I want to do is click on a thumbnail and reload the flash video player with a different video.

 

I understand flash vars and embed objects. It's the reloading of the new content I don't get.

 

I want to try and do it in the way that youtube does.

 

Click on thumbnail with id of 0

E.g http://www.mysite.com/video?id=0

 

Click on thumbnail with id of 1

E.g http://www.mysite.com/video?id=1

 

Click on thumbnail with id of 2

E.g http://www.mysite.com/video?id=2

 

 

 

I'd appreciate it if somebody could show me an example of or point me towards a good tutorial of this basic Implementation. Conceptually I would have a pretty good idea what going on, I just don't have a point of reference to start from and an example or tut would help me out greatly.

 

 

Link to comment
https://forums.phpfreaks.com/topic/179946-newbie-navigation/
Share on other sites

You are probably looking some Javascript code instead of PHP.

 

Javascript will be able to dynamically change the "src" of the embedded object without reloading the page.

 

This is rather similar to another topic I replied to previously: http://www.phpfreaks.com/forums/index.php/topic,274406.0.html. He, however, used a drop-down menu to select the video. The concept is similar, to dynamically change the URL of the embedded object.

 

PHP will also be able to accomplish a similar effect, but the page will have to be reloaded before the new video is displayed. This will involve changing the "src" within the html code itself using inline PHP.

Link to comment
https://forums.phpfreaks.com/topic/179946-newbie-navigation/#findComment-949285
Share on other sites

Thats a helpful insight.

 

I can see the benefits of using a javascript call.

 

The reason that I wanted to use PHP was to try and improve search ability with search engines. I thought this could of been achieved with the youtube approach where every video has a unique URL.

 

Will using the javascript method you describe give me the same benefits?

 

From looking at the example link you posted I guess I could maybe return a php page  into my video player div??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/179946-newbie-navigation/#findComment-949294
Share on other sites

It would not exactly be returning "a page", but rather, the code for the embedded player. This would fall under AJAX.

 

If your PHP returns an entire page, then when the user clicks on a thumbnail, you will have a page within your current page!

 

However, if you want a youtube-style site, you can do away with Javascript and load the correct src using PHP. I'm not really into SEO, but I guess videos loaded by Javascript will be ignored by most crawlers, so the second option seems to be a better choice if you are worried about search engine crawlers..

 

For each page, you will have something like:

...
echo "<embed src=\"".getVideo($_GET['id'])."\">";
...

where the getVideo function returns the URL of the video with the specified ID.

 

HTH

Link to comment
https://forums.phpfreaks.com/topic/179946-newbie-navigation/#findComment-949304
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.