Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: ZylochPosted on 2004-07-08 at 15:23:20ID: 11507413
Yes, it is possible with server-side scripting languages like JSP, but you would also need a database or a text file.
t"; //This path is an example one.
vers);$i++ ) {
I'm pretty clueless at JSP, so I'll give you a small example in PHP:
Depending on whether you use a textfile or a database, you would need to manually add the server unless you create something to do it for you. For that reason, it's best if your site isn't heavily used to use a textfile (very easy), but if you have a large volume of people, you should use a database (for PHP, best is with MySQL);
For an example with a textfile, it might be something like this:
<?php
//For the text files, put a different server on each line.
$menufile="files/server.tx
//Open with PHP
$fp = fopen($menufile, "r");
//Get the server names and close the file.
$contents = fread($fp, filesize($menufile));
fclose($fp);
//Now $contents has what's in the file, so split up the files into an array by the newlines.
$arrayOfServers = explode("\r\n", $contents); //If this is stored on Unix server, use the \r\n, otherwise use \n.
?>
<!-- Skip a bit until you get to your menu part, this could be something simple like this:
<body>
<div>
<?php
for ($i=0;$i<count($arrayOfSer
echo("<a href='SOME LINK'>" + $arrayOfServers[$i] + "</a><br>");
}
?>
</div>
</body>
I know that the above menu is simplified, and that it doesn't have the server links, but it can easily done if you either
1) Make another file with the server links (make sure the links are on the same line as the name is, i.e. if ServerName is on line 1 in server.txt, then ServerNameLink has to be on line 1 in serverlink.txt then you can use the for loop above because the $i will refer to both arrays.
2) In server.txt, have it in this format:
ServerName1,ServerLink1
ServerName2,ServerLink2
ServerName3,ServerLink3
Then have PHP explode() the according to "\r\n" then explode each of the members of the resulting array using a for() loop by the commas to get an array of server links (for the href) and an array of servernames (for the link names)
Of course, this is assuming you are using PHP, if you are using another server-side scripting language, either learn about filehandling in it or ask the experts in that particular section.