Getting array links from .txt file.. Help please..

Hello,

I want to create a galery website. I have a random button and when someone clicks it i want site to load another url from a list in a txt file… I found a script like below but i have to enter all links manualy to every page… Can you modify this code so it can get array links from a txt file? And how must i write the links into the txt file? With , or ; after them? Thank you very very much…

Ok, we’re talking about Javascript here.

Javascript is a client side programming language only. You can achieve what you want to by using PHP, ASP, Perl or another server side coding language to read the contents of the file, store each line in an array. This can be done very easily in php, observe;

<?php
$f = fopen("my.txt",+a);
$r = fread($f, filesize("my.txt"));
$myArray = explode("\r\n",$f);
echo "<script>\n \$array = new Array(); ";
$i=0;
foreach($myArray){
echo "\$array[".$i."] = '.$myArray[i]."';\n ";
$i++;
}
echo "</script>";
?>

This is just going from memory.