Page 1 of 1
How do i make a list that automatically changes order?
Posted: Thu Mar 26, 2009 5:31 pm
by Seraphimk
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?
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 5:28 am
by greyhoundcode
Change them in what way? Randomly?
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 12:44 pm
by Seraphimk
greyhoundcode wrote:Change them in what way? Randomly?
the order as in if there's a list of sites they just change the order they are seen
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 1:23 pm
by php_east
shuffle
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 1:33 pm
by Seraphimk
php_east wrote:shuffle
yh i just don't know how to write a script that would shuffle them
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 2:11 pm
by php_east
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?
Posted: Fri Mar 27, 2009 5:35 pm
by Seraphimk
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.
so what would i write im not that great at php so what would i write exactly?
Re: How do i make a list that automatically changes order?
Posted: Fri Mar 27, 2009 8:27 pm
by php_east
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?
Posted: Sat Mar 28, 2009 6:03 am
by Seraphimk
php_east wrote:you would write an array consisting of a list of domains, and then you shuffle the array. that's it.
but i want to make the list within a table would i create a table then put the php code within it ?
Re: How do i make a list that automatically changes order?
Posted: Sat Mar 28, 2009 8:03 am
by php_east
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?
Posted: Sat Mar 28, 2009 12:01 pm
by Seraphimk
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>';
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?
Re: How do i make a list that automatically changes order?
Posted: Sat Mar 28, 2009 12:35 pm
by php_east
yes, sure.
Re: How do i make a list that automatically changes order?
Posted: Sat Mar 28, 2009 8:21 pm
by Chris Corbyn
~ 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
