How do i make a list that automatically changes order?
Moderator: General Moderators
How do i make a list that automatically changes order?
i want to make a list that lists a load of sites and that automatically changes the order the sites are shown without me having to do anything does anyone know of a script that can do this?
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: How do i make a list that automatically changes order?
Change them in what way? Randomly?
Re: How do i make a list that automatically changes order?
the order as in if there's a list of sites they just change the order they are seengreyhoundcode wrote:Change them in what way? Randomly?
Re: How do i make a list that automatically changes order?
yh i just don't know how to write a script that would shuffle themphp_east wrote:shuffle
Re: How do i make a list that automatically changes order?
you don't have to, it's already written
( from PHP manual)
Description
bool shuffle ( array &array )
This function shuffles (randomizes the order of the elements in) an array.
( from PHP manual)
Description
bool shuffle ( array &array )
This function shuffles (randomizes the order of the elements in) an array.
Re: How do i make a list that automatically changes order?
so what would i write im not that great at php so what would i write exactly?php_east wrote:you don't have to, it's already written
( from PHP manual)
Description
bool shuffle ( array &array )
This function shuffles (randomizes the order of the elements in) an array.
Re: How do i make a list that automatically changes order?
you would write an array consisting of a list of domains, and then you shuffle the array. that's it.
Re: How do i make a list that automatically changes order?
but i want to make the list within a table would i create a table then put the php code within it ?php_east wrote:you would write an array consisting of a list of domains, and then you shuffle the array. that's it.
Re: How do i make a list that automatically changes order?
maybe not the entire table in php, you can use php just to generate just the list.
Code: Select all
<?php
$domains = Array();
$domains[] = 'http://www.google.com';
$domains[] = 'http://www.yahoo.com';
$domains[] = 'http://www.yuhuu.com';
:
:
:
shuffle($domains);
echo '<ul>';
foreach ($domains as $key=>$domain)
{ echo '<li><a href="'.$domain.'" >'.$domain.'</a><li>'; }
echo '</ul>';Re: How do i make a list that automatically changes order?
would i be able to put a time limit so it shuffles every 10 min or if i just put a meta refresh tag would that work?php_east wrote:maybe not the entire table in php, you can use php just to generate just the list.Code: Select all
<?php $domains = Array(); $domains[] = 'http://www.google.com'; $domains[] = 'http://www.yahoo.com'; $domains[] = 'http://www.yuhuu.com'; : : : shuffle($domains); echo '<ul>'; foreach ($domains as $key=>$domain) { echo '<li><a href="'.$domain.'" >'.$domain.'</a><li>'; } echo '</ul>';
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: How do i make a list that automatically changes order?
~ Seraphimk, the best way to learn is to take away the pointers people give you and to experiment with them before you ask further questions. There's nothing lost by just trying things to see what happens 