Re: I need help!!!
| From: | Mike Flynn | Date: | Mon, 21 May 2001 14:47:24 +0000 |
| Subject: | Re: I need help!!! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7786@lists.php.net to get a copy of this message | ||
Read one line from the text file at a time.
Then use explode to separate it by semicolons.
Haven't ever done it from a text file myself, but something SIMILAR to this should work:
<table border="1" cellpadding="3" cellspacing="0">
<?php
$source_file = file('\\path\\to\\file\\filename.dat');
foreach($source_file as $current_line) {
list($str1, $url1, $int1, $str2) = explode(';', $current_line);
print " <tr>\n";
print " <td><a href="$url1">$str1</a></td>\n"; print " <td>$int1</td>\n"; print " <td>$str2</td>\n";print " </tr>\n"; } ?> </table> At 03:45 PM 5/21/01 +0200, you wrote:
Alain Menard wrote: I clicked on the send button to fast... The part that i'm having problem with is the second part. Especially the one about the first string becomming a link to the corresponding URL. ""Alain Menard"" <menard.alain@videotron.ca> wrote in message news:9dv3k5$873$1@toye.p.sourceforge.net...Hi!! I'm presently working on my personal web site and i would like to use PHPtodo the following : 1- Read a string in the following format from a text file :format :string;url;integer;string string;url;integer;string string;url;integer;string ... string;url;integer;string2- Generate a page containing the resulting list in the followingAs i am a newbie myself - i cannot sypply you with the complete code example. I suggest that you look at some example code on how to parse a textfile. You get your STRING linked you use it in a html HREF tag as follows: <? $url="http://www.altavista.com"; $msg="Altavista search"; ?> <a href="<? echo $url; ?>"> <? echo $msg; ?> </a> The example above may not be the best solution, but i have tried it on my installation and it works. -- Michel Laine CAUTION! In order to eliminate spam i have included 'NOSPAM' in my return address. To relpy directly to me please remove the NOSPAM in order for the reply to propagate correctly. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netstring integer string string integer string string integer string ... string integer stringwhere the first string is a link to the corresponding url.Any help would be welcome at this point. Thank you in advance... Alain Menard
-=- Mike Flynn - Burlington, VT -=-mike@mikeflynn.net http://www.mikeflynn.net/ * Give blood * Wouldn't the free market, in its true form, be anarchy?