-1

Hello i want to make something like this:

<script>fid="canal1"; width=650; height=440;</script><script type="text/javascript" src="http://www.pirlotv.me/embed.js"></script>

That script create an autoadjustable iframe

As you can see here

That <iframe> contains an script with a video stream

enter image description here

When you change the width or height property in the URL it also changes in the html document, how can I do something like that? Please help me

Yotam Omer
  • 15,310
  • 11
  • 62
  • 65
FlyezTV
  • 13
  • 1
  • 4

1 Answers1

2

If I understand you correctly you will have to do something like this:

In the URL use get variables like so: www.mywebsite.com/page.php?width=200&height=300

Then use echo $_GET['width']; and echo $_GET['height']; to print where you need.

For example:

<script>fid="canal1"; width=<?php echo $_GET['width'];?>; height=<?php echo $_GET['height'];?>;</script>

I would also recomment using isset() function to see if the $_GET vars are actually set and if not assign some default value.. like this:

<?php echo isset($_GET['width']) ? $_GET['width'] : '250'; //250 being the default value ?>
Yotam Omer
  • 15,310
  • 11
  • 62
  • 65
  • Yeah, you undestood, Is there a way to make it with HTML or Javascript? – FlyezTV Jun 17 '13 at 22:23
  • You can get the Get variables using javascript like [this example](http://papermashup.com/read-url-get-variables-withjavascript/). You can read the hash using [this example](http://stackoverflow.com/questions/11920697/how-to-get-hash-value-in-a-url-in-js) – Yotam Omer Jun 17 '13 at 22:25
  • But in PHP i cant use it :S http://redzeronline.ucoz.com/php/canal1.php?width=650&height=440, i cant quit that: ({"SCRIPTDATA":" it seems that it changes the code. – FlyezTV Jun 18 '13 at 01:58
  • And i dont understand that example in javascript, it would be easier without using php – FlyezTV Jun 18 '13 at 02:02
  • Without `PHP`: add the code underneath "The Code" from [this webpage](http://papermashup.com/read-url-get-variables-withjavascript/) to your site above the `` – Yotam Omer Jun 18 '13 at 09:36
  • But i mean to combine html and javascript without using php, its because a huge number of users will visit it and the php server is paid and the html free – FlyezTV Jun 19 '13 at 00:08
  • **MY LAST COMMENT DOES NOT USE PHP AT ALL** :) hope you read it.. – Yotam Omer Jun 19 '13 at 00:22
  • The example is this one: http://mywebpage.com/index.php?id=123&page=home can it be http://mywebpage.com/index.html?id=123&page=home ?? – FlyezTV Jun 19 '13 at 17:50
  • yes :). make sure you don't use anywhere in the page... – Yotam Omer Jun 19 '13 at 18:30