Comment rendre cliquable un lien .txt include?
Posté : 19 juil. 2006, 21:00
Allo,
J'ai trouvé ce scripts.
il ouvre un fichier .txt dans une page PHP.
Je souhaiterai le modifier.
Pouvez vous m'aider?
Comment je peux transformer chaque mot ou phrase en liens?
Par exemple, j'ai les mots clés suivants dans mon fichier .txt
Computer
laptop
website hosting
ect....
Chaque mot ou phrase doivent devenir un lien.
Ensuite, je souhaiterai ajouter une image .gif avant chaque liens, just une petite fleche ->.
Ceci est pour mon site
http://www.composantinformatique.com
Mon résulat est
http://www.composantinformatique.com/sc ... 1ligne.php
le fichier texte
http://www.composantinformatique.com/scripts/links.txt
Merci pour votre aide.
J'ai trouvé ce scripts.
il ouvre un fichier .txt dans une page PHP.
Code : Tout sélectionner
<?
$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==1){
echo "</tr><tr>";
echo "<td>$contents[$a]</td>";
$i=0;
}else{
echo "<td>$contents[$a]</td>";
}
}
echo "</tr></table>";
?> Pouvez vous m'aider?
Comment je peux transformer chaque mot ou phrase en liens?
Par exemple, j'ai les mots clés suivants dans mon fichier .txt
Computer
laptop
website hosting
ect....
Chaque mot ou phrase doivent devenir un lien.
Code : Tout sélectionner
<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> Ceci est pour mon site
http://www.composantinformatique.com
Mon résulat est
http://www.composantinformatique.com/sc ... 1ligne.php
le fichier texte
http://www.composantinformatique.com/scripts/links.txt
Merci pour votre aide.