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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.