4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Trying to create a simple table... no such luck. Help!
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Gizmo
Junior WebHelper
Junior WebHelper


Joined: 18 Jun 2002
Posts: 1

PostPosted: Tue Jun 18, 2002 3:45 pm (15 years, 4 months ago) Reply with QuoteBack to Top

Apologies if the code below looks somewhat jumbled. Cut and paste problems ) Basically what it does is reads all the .htm files in a directory and displays them on a php page (with different names). At the moment it is only displaying them in one column (each file a different row), but I'd like to be allowed to set the number of columns, e.g. 6. I thought I had this set up but it isn't working. Any ideas? Where do I put the <td> and <tr> tags??

thanks,
Gizmo

Code:

<?
/* DECLARATIONS */
$col = 1;
$numcols = 6;
$p = "results";
$d = opendir($p);

$f = readdir($d);

echo("<p align='center' class=gen><u><b>Results</b> (please click on a link below)</u><br>&nbsp;<br><table cellSpacing=2 cellPadding=1 bgColor=#e6e6e6 border=0>");

while($f !== false)
{
if($f != "." and $f != ".." and $f != "index.htm") {
if($col ==1) {
echo("<tr>");

$prettyname = $f;
$prettyname = eregi_replace("jan", "January ", $prettyname); }
$prettyname = eregi_replace("feb", "February ", $prettyname);
$prettyname = eregi_replace("mar", "March ", $prettyname);
$prettyname = eregi_replace("apr", "April ", $prettyname);
$prettyname = eregi_replace("may", "May ", $prettyname);
$prettyname = eregi_replace("jun", "June ", $prettyname);
$prettyname = eregi_replace("jul", "July ", $prettyname);
$prettyname = eregi_replace("aug", "August ", $prettyname);
$prettyname = eregi_replace("sep", "September ", $prettyname);
$prettyname = eregi_replace("oct", "October ", $prettyname);
$prettyname = eregi_replace("nov", "November ", $prettyname);
$prettyname = eregi_replace("dec", "December ", $prettyname);
$prettyname = eregi_replace(".htm", "", $prettyname);

echo("<td bgColor=white valign='center' align='center'>"); echo("&nbsp;&nbsp;<a href=results/$f>$prettyname</a>&nbsp;&nbsp;");};
$f = readdir($d) ; }
echo("</td>");


$col++;

if($col-1 == $numcols) {
echo("</tr>");
$col=1;
}
// }
echo("</tr></table></p>");
closedir($d);
?>
OfflineView User's ProfileFind all posts by GizmoSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jun 23, 2002 7:39 am (15 years, 4 months ago) Reply with QuoteBack to Top

I'm not sure what you're asking, and it would be good to see the output of that script, but here's the syntax for a simple table.

Code:
<table>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
</tr>
</table>

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.051165 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme