Jump to content

How to make links with .txt file results


ginocote

Recommended Posts

Hi,

I got this script and it's working well.
for opening a .txt file and open it in a php webpage.

[code]<?
$filename = "some_text_file.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);

$contents=explode("\n", $contents);

echo "<table><tr>";

$i=-1;
$a=-1;
while($a < count($contents)){
$i++;
$a++;
  if($i==3){
      echo "</tr><tr>";
            echo "<td>$contents[$a]</td>";
      $i=0;
  }else{
      echo "<td>$contents[$a]</td>";
  }
}


echo "</tr></table>";
?> [/code]

I want to modify it.
can someone help me with this?

How can i do to make each word or phrase become a link?

For example i have these keywords in my text files

Computer
laptop
website hosting
ect....

each word or phrase have to become a query link.
[code]
<a href="http://www.mysite.com/search?q=computer">Computer</a>
<a href="http://www.mysite.com/search?q=Laptop">Laptop</a>
<a href="http://www.mysite.com/search?q=Website Hosting">Website+Hosting</a> [/code]

i need to place a .gif image before each link, like a little arrow.

This is for my website
http://www.composantinformatique.com

This is my results
http://www.composantinformatique.com/scripts/menufromtext1ligne.php
The .txt file
http://www.composantinformatique.com/scripts/links.txt


Than you to help
Link to comment
https://forums.phpfreaks.com/topic/15064-how-to-make-links-with-txt-file-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.