HTML/Php how to change the content of the page according to the inserted end

Asked

Viewed 288 times

0

I have an HTML here that I use to generate Players on My Site

But I have to keep changing the contents of the file to access Different Videos

I’d like to know if there’s a way to change the area:

De acordo com a url inserida Exemplo

www.site.com.br/Player.html?video=video.mp4;img=img.png

Teria que mudar o Arquivo para Php?
Por Favor me Ajude não tenho experiencia com Programação WEB

HTML:

<video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
      controls preload="none" poster='https://image.tmdb.org/t/p/w780/fVcZErSWa7gyENuj8IWp8eAfCnL.jpg'
      data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
    <source src="" type='video/mp4' />

  </video>
  • Why would you like to use PHP? your website is in PHP? I think a javascript already solves.

  • I use Wordpress, However I have no idea how to do this!

  • If that’s all your player is, you could make a simple PHP program that uses the arguments from $_GET to fill in what will appear in the video. But you’ll have to learn some PHP if you want to start with the manual: http://php.net/manual/en/reserved.variables.get.php

1 answer

1


You can only use the $_GET address variables. Following your example (I fixed the tab ; for &:

www.site.com.br/Player.php?video=video.mp4&img=img.png

You have two attributes, "video" and "img", and their values. So PHP is very simple:

<video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
  controls preload="none" poster='<?= $_GET['img'] ?>'
  data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
<source src="<?= $_GET['video'] ?>" type='video/mp4' />

The result would be:

<video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
  controls preload="none" poster='img.png'
  data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
<source src="video.mp4" type='video/mp4' />

You can then improve the code to not show the video if, for example, there is no argument, but then it would be better to sit down and learn to program.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.