[thelist] White Line in IE
Joe Crawford
jcrawford at avencom.com
Sun Jun 3 14:47:11 CDT 2001
on 6/3/2001 12:30 PM, Beau Hartshorne at beau at uvic.ca wrote:
> I designed this site (http://www.posterngateinn.com/) a while ago on my
> Mac. I've recently upgraded to a PC
<snip>
That's not an UPgrade. That's a CROSSgrade. Some might even call it a
DOWNgrade. ;-)
- Joe <http://artlung.com/>
Definitely owe a tip for that!
<tip type="php trick with tab delimited files">
I recently devised a nice way to turn a tab delimited file into a pretty
html table. Check out the code, probably could be modified to work with
other server parsed languages.
<table cellspacing=1 cellpadding=2 border=0 bgcolor="#000000"><tr><td>
<table cellspacing=1 cellpadding=2 border=0 bgcolor="#EEEEEE"><?
$tdf=file($in_file); //make $in_file a tab delimited file
for ($i;$i<sizeof($dogdoo);$i++) {
if($c!=" bgcolor='#CCCCCC'") {$c=" bgcolor='#CCCCCC'";} else {$c='';};
// alternates colors
$temp = "";
$temp = ereg_replace("^","<tr valign=top $c><td>",$tdf[$i]);
// puts <tr> at the beginning of each row
$temp = ereg_replace("\t"," </td><td>",$temp);
// puts </td><td> between tabs
$temp = ereg_replace("$","</td></tr>\n",$temp);
// closes each row
echo $temp;
// and print!
};
?></table></td></tr></table>
Quick and dirty, eh? It works because file() puts each individual line of
the file into an array which can be messed with. Cool eh?
</tip>
More information about the thelist
mailing list