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
https://forums.phpfreaks.com/topic/148805-randomizing-html-content-with-no-dupes/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

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