Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] tablica, jak ją includować
-Guest-
post
Post #1





Goście







w pliku dane.dat mam przykładowo:
Kod
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona1 | Opis1 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona2 | Opis2 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona3 | Opis3 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona4 | Opis4 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona5 | Opis5 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona6 | Opis6 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona7 | Opis7 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona8 | Opis8 | <img src="2.gif">
<img src="1.gif"> | &nbsp;&raquo;&nbsp; | Strona9 | Opis9 | <img src="2.gif">

jak to includować do linki.php aby z tego otrzymac np:
Kod
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
<img src="1.gif">&nbsp;&raquo;&nbsp;<a href="http://www.mp.pl/" target="_blank">Medycyna Praktyczna</a>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
matrach
post
Post #2





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 17.04.2006

Ostrzeżenie: (0%)
-----


Zamiast fread najlepiej użyć funkcji file()
  1. <?php
  2.  
  3. $file="plik.txt";
  4. $dane = file($file);
  5.  
  6. foreach ($dane as $dana)
  7. {
  8. $tmp=explode("|",$dana);
  9.  echo '<img src="images/cross.gif" alt="" width="15" height="16" border="0" align="middle" />&nbsp;&raquo;&nbsp;<a href="' . $tmp[0] . '" target="_blank">'.$tmp[1].'</a> - <img border="0" align="middle" src="http://pr.blogflux.com/pr3.php?s='.$tmp[0].'"<br />';
  10. }
  11. ?>

I usuń odstęp w pliku linki.dat pomiędzy "|", a danymi
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 16:24