Jump to content

Recommended Posts

Ok I am making a code to get more youtube views

 

And i need it so in a form you set number of Videos to be displayed in number of seconds

 

So The Form Would Look Like This

 

<table border="1">
<tr>
<td>(Number)<input type="text" name="times" value="10"> of Times to Display Video in <input type="text" name="reloadtime" value="5">(Seconds)
</td>
</tr>
</table>

 

So if The Number is Set to 10 Which is default

Then it displays this code 10 times

 

echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$url&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$url&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="$allowfullscreen" width="$setwidth" height="$setheight"></embed></object>';

 

and if its set to 20 then it displays that code 20 times is this possible

 

Do you want it to display like that code 20 times every x seconds?

 

If so, javascript would be the way to set this up, not necessarily ajax but if you code in the JScript it should work.

 

Also the slee might work, but the page would not finish loading until all the items have been displayed and chances are the browser would time out.

<?php
$numTimes = 10;

for ($i=0; $i < $numTimes; $i++) {
echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$url&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$url&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="$allowfullscreen" width="$setwidth" height="$setheight"></embed></object>';
}
?>

 

Will display it 10 times on the page.

So Would this work

 

<?php
$numTimes = $_POST['times'];

for ($i=0; $i < $numTimes; $i++) {
echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$url&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$url&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="$allowfullscreen" width="$setwidth" height="$setheight"></embed></object>';
}
?>

So Would this work

 

<?php
$numTimes = $_POST['times'];

for ($i=0; $i < $numTimes; $i++) {
echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$url&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$url&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="$allowfullscreen" width="$setwidth" height="$setheight"></embed></object>';
}
?>

 

Should, although I would do this

 

<?php
$numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10;

for ($i=0; $i < $numTimes; $i++) {
echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$url&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$url&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="$allowfullscreen" width="$setwidth" height="$setheight"></embed></object>';
}
?>

 

That way if it isset and is numeric it is set to that value, else it is defaulted to 10.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.