Jump to content

Randomizing html content with no dupes.


iflycc

Recommended Posts

I have managed to get 2 separate instances of randomization on the same page, with the same content. However because there are only 4 items being randomized it is possible to prevent them from duplicating each other?

 


code:

 

 

<?php

$random[] = "<p><img src\"images/sub_nav_downloads.jpg\"><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic1.jpg\" width=\"83\" height=\"78\" class=\"floatleft\"></a>This hand carved stone statue was scanned by our Breuckmann SteroSCAN 6.6 mp scanner.</p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic2.jpg\" width=\"83\" height=\"72\" class=\"floatleft\"></a>View the incredible resolution and detail capable with white light scanning technology.<br></p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic3.gif\" width=\"83\" height=\"72\" class=\"floatleft\"></a>Approximately 3” in height, this small airfoil from a jet engine was scanned using our Breuckmann SmartScan 1.4 mega pixel.</p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic4.gif\" width=\"83\" height=\"72\" class=\"floatleft\"></a>This is an inspection report completed with PolyWorks IMInspect.</p>";

 

echo $random[rand(0,count($random)-1)];

?>

 

            <p> </p>

           

            <?php

$random[] = "<p><img src\"images/sub_nav_downloads.jpg\"><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic1.jpg\" width=\"83\" height=\"78\" class=\"floatleft\"></a>This hand carved stone statue was scanned by our Breuckmann SteroSCAN 6.6 mp scanner.</p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic2.jpg\" width=\"83\" height=\"72\" class=\"floatleft\"></a>View the incredible resolution and detail capable with white light scanning technology.<br></p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic3.gif\" width=\"83\" height=\"72\" class=\"floatleft\"></a>Approximately 3/” in height, this small airfoil from a jet engine was scanned using our Breuckmann SmartScan 1.4 mega pixel.</p>";

 

$random[] = "<p><a href=\"info_downloads.htm\"><img src=\"images/sub_nav_downloads_pic4.gif\" width=\"83\" height=\"72\" class=\"floatleft\"></a>This is an inspection report completed with PolyWorks IMInspect.</p>";

 

echo $random[rand(0,count($random)-1)];

?>

Link to comment
Share on other sites

  • 2 weeks later...
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.