You are here: Re: Parsing CSV-file and adding CSS to style « PHP Programming Language « IT news, forums, messages
Re: Parsing CSV-file and adding CSS to style

Posted by Ψrjan Langbakk on 06/24/06 13:20

Den 24.06.2006 14:40, skriblet Geoff Berrow fΓΈlgende:
> Message-ID: <449d2e3f$1@news.broadpark.no> from Ørjan Langbakk contained
> the following:
>
>> I need to have each <td> present in the code, so as to be able
>> to assign a class to the last one, but how? I can tell as much as that I
>> know the number of <td>'s in each CSV-file - they are a constant).
>>
>> Any help would be appreciated.
>
> Untested.
> ...
> $this->html .= "<tr>";
> $count=0;
> foreach($row as $field){
> if($count<3){
> $this->html .= "<td>$field</td>";
> }
> else{
> $this->html .= "<td
> style='text-align:center'>$field</td>";
> }
> $count ++;
> }
> $this->html .= "</tr>\n";
>
> ...

Works like a charm :)

Now, is there a way I can use _this_ code to also add styles to other
<td>s? Or is this a "one-stop" option? I tried adding more counts, but
couldn't seem to get it right - probably because I missed a basic point
somewhere :)

--
mvh
Ørjan Langbakk

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация