Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Random display of SWF file (PHP)
Old 06-16-2004, 04:44 AM Random display of SWF file (PHP)
Junior Talker

Posts: 1
Trades: 0
Hi all -

I have just started working on this website

[ www.larrydevincenzi.com/SAtemp/sa.html ]

If you would take a moment to review the page (only the front page) and take note to the animated flash banner.

My origional intention was to create 5 or 6 of these banners (as I have done) and have some sort of script pull up the SWF files at random.

So far I have tried a few things - namely using PHP. I have got the PHP to display anything from GIF to JPG in random sequence (as you may notice at the very bottom, strange random images) but I cant seem to get it to pull up the SWF files, when the SWF is selected it just returns random.

Could anyone point me in the direction of advice?

Thanks!

Tony.
Tonydev is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-17-2004, 09:44 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
All you'd need to do is get an array to hold your SWF HTML, then generate a random number and use it to display one of the array items.

PHP Code:
<?php

$swf_html
[] = 'html1';
$swf_html[] = 'html2';
$swf_html[] = 'html3';
// etc.

// if your PHP version is less then 4.2.0 then you'll need to
// seed the random number generator:
// [url]http://ca2.php.net/manual/en/function.mt-srand.php[/url]

$rand mt_rand(0count($swf_html) - 1);

echo 
$swf_html[$rand];

?>
Hope that helped
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Random display of SWF file (PHP)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28931 seconds with 12 queries