| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Sep 2005
Posts: 7
![]() | Randomize code? Sorry to ask a simple question, but I'm looking to randomise a display of content, which are called up with basic PHP include files. So if there are 5 images, I'm calling them up as: Code:
<!-- site content above -->
<?PHP include("/home/user/public_html/section1.php"); ?>
<?PHP include("/home/user/public_html/section2.php"); ?>
<?PHP include("/home/user/public_html/section3.php"); ?>
<?PHP include("/home/user/public_html/section4.php"); ?>
<?PHP include("/home/user/public_html/section5.php"); ?>
<!-- footer below --> ????: NamePros.com http://www.namepros.com/programming/124811-randomize-code.html How would I randomise with a script within the body itself? Many thanks for any replies. |
| |
| | #2 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | do you want to randomize the section1, section2, section3, etc? or do you want to randomize something INSIDE section1, section2, etc? here's a link to the php random manual anyway: http://us3.php.net/rand
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | #3 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,552
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | That's it rand() should do the trick. I would do something like... (untested) ????: NamePros.com http://www.namepros.com/showthread.php?t=124811 PHP Code: |
| |
| | THREAD STARTER #4 (permalink) |
| New Member Join Date: Sep 2005
Posts: 7
![]() | The trouble is trying to get the files 1-5 to be returned in a random order - ie, page load: file 5, file 3, file 1, file 4, file 2 refresh: file 3, file 2, file 5, file 1, file 4 refresh again: file 2, file 4, file 1, file 3, file 5 |
| |
| | #5 (permalink) |
| Senior Member Join Date: May 2004 Location: France
Posts: 1,226
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Something like that maybe... PHP Code: |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Various names - AngloSaxons.info... | Catsse | Domains For Sale - Make Offer | 0 | 09-14-2005 06:49 PM |
| 2 Huge Name Forsale | Vegas Entertainment | Domains For Sale - Make Offer | 9 | 09-21-2004 03:37 PM |
| CorePimps Code Is For Sale! | contemptx | For Sale / Advertising Board | 2 | 07-20-2004 10:24 AM |
| Free Source Code Protector! | getthis | For Sale / Advertising Board | 7 | 05-10-2004 04:14 PM |