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.

PHP Forum


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



Freelance Jobs

Reply
PHP: random ordering of content?
Old 09-18-2005, 05:41 PM PHP: random ordering of content?
Experienced Talker

Posts: 45
Location: Yorkshire, UK
Trades: 0
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 -->

How would I randomise with a script within the body itself?

Many thanks for any replies.
__________________

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
|
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
|
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
|
Please login or register to view this content. Registration is FREE

I, Brian is offline
Reply With Quote
View Public Profile Visit I, Brian's homepage!
 
 
Register now for full access!
Old 09-19-2005, 01:49 AM
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
I always use the rand function with if statments for randomly selecting things.
Something like:
PHP Code:
<?php
$rand 
rand(13);

if(
$rand == "1");
{
do 
this
}
if(
$rand == "2");
{
do 
that
}
if(
$rand == "3");
{
do 
the other
}
?>
__________________

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
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 09-19-2005, 02:47 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
here's one I wrote earlier

http://www.webmaster-talk.com/showthread.php?t=35276
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to PHP: random ordering of content?
 

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.46172 seconds with 12 queries