Hi, here is what I would like to acomplish but cant figure out the proper way to do it:
Basicaly I have a page where I want to display links. To do this, I use a list of URLs from a text file, which I call like so:
$array=file("links.txt");
And then use the following to display each link as list elements:
foreach ($array as $item => $value) {
print "<li><a href=\"http://$value\" class=\"g\"><b>$urlname</b></a>\n";
}
(I dont fully understand how the foreach argument really works but its working. I have no clue what $item should be...but that's not my concern right away.)
So far this works fine. Except for one detail. You see that "$urlname" up there? I would like that to be the link's name obviously. How would I define it in my list of links from link.txt ?
Right now that file is setup like so:
www.web1.com
www.web2.com
www.web3.com
I would like to define $urlname in there as well. I was thinking of setting it up like this:
www.web1.com=link one
www.web2.com=link two
www.web3.com=link three
This way I would define two variables (as seperated by "=") from each string in my array.
Now does anyone have any idea how to do this?
Thank you!