• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PHP SWF Generic Function

artofwork

Well-Known Member
Joined
Dec 3, 2008
Messages
420
Reaction score
61
Wrote this simple function for a friend a few days ago, might be useful for someone.

Also this will get you accustomed to loading content from an external php file.

Call the source.php file what you want, as long as you keep the php extension.

source.php
PHP:
<?php

$video1 = 'http://www.youtube.com/p/C93BE23562D8372C&amp;hl=en&amp;fs=1';
$video2 = 'https://www.pandora.com/radio/tuner_9_0_0_0_pandora.swf';
$video3 = '';
// etc.. 
?>

<?php

function swf($width, $height, $src, $ToF, $always)
{
$flash = '<object width="'.$width.'" height="'.$height.'">
   <param name="movie" value="'.$src.'">
   </param>
   <param name="allowFullScreen" value="'.$ToF.'">
   </param>
   <param name="allowscriptaccess" value="'.$always.'">
   </param>
   <embed src="'.$src.'" type="application/x-shockwave-flash" 
   allowscriptaccess="'.$always.'" 
   allowfullscreen="'.$ToF.'" 
   width="'.$width.'" 
   height="'.$height.'">
   </embed>
   </object>';

echo($flash);
}
?>


Implementation:

Basically you can take a pure html page, change the extension
from html to php and very easily call the swf() function, like so..

index.php
PHP:
<html>
<head>
</head>
<body>
The require_once() function is needed, place this 
somewhere on the page prior to calling the swf function
<?php require_once('source.php'); ?>

This will create all the necessary tags needed to 
run an swf in the webpage, without having to 
rewrite the code over and over.
Example:
<br />
<?php swf(480, 385, $video1, 'true', 'always'); ?>
<br />
<?php swf(800, 600, $video2, 'true', 'always'); ?>

</body>
</html>
 
Last edited:
Back
Top