is there a way to extract a link out of a .txt file and have it clickable? It would be easier with a database but there isn't one to use.
Thanks.
is there a way to extract a link out of a .txt file and have it clickable? It would be easier with a database but there isn't one to use.
Thanks.
nevermind I got it.
links.txt:
www.hallo.de
www.hallo.com
www.hallo.org
script.php
<?PHP
$list = file("links.txt");
explode(';', str_replace('\n','', implode(';', $list) ) );
for ($i=0; $i < sizeof($list); $i++)
{
echo "Link" . $i . ": <a href=\"http://" . $list[$i] . "\">" . $list[i] . "</a><br>";
}
?>
UNTESTED
what exactly does that do in lamens terms?
i dont understand explode and implode yet
implode: combines the parts of an array to a single string,
$glue = '+';
$array = array("hello", "world", ",it's me");
$string = implode($glue, $array);
echo $string; // prints "hello+world+it's me"
explode does the opposite, it divides a string at a char and returns
an array, containnig the parts WITHOUT the "glue"
$array2 = explode("+", $string);
it's often useful to have glue = "" when using implode
the example above just removes the linebreaks from all elements
in the array
could be done with preg_replace, too