I'm new to PHP and am still trying to get my head round the programming style.
I have a PHP page which confirms the upload of a file to my site and then displays a list of currently uploaded files. This list is displayed in table format and I want to make it less boring!
I have a "snippet" created for Dreamweaver MX which changes the background colour of each row in the table as your cursor passes over it. Problem is I can't figure out the ground rules on how this might be incorporated into the PHP page/script.
Can anyone tell me if it can be done?
Do I have to insert the code into the relevant places in the PHP code or can I get the snippet code to be incorporated by using an "include" statement which references the snippet code and incorporates it in the PHP code?
Can anyone lend a hand please?
-------------- PHP Code ----------------
<?PHP
//set counter to 0
$tfiles = 0;
//open directory for reading files
$dh = opendir( $ufolder ) or die("Could not open directory");
//read files
while ( ! ( ( $file = readdir( $dh ) ) === false ) ) {
//make sure file isn't in the don't read list
if ( is_file( "$ufolder/$file" ) and (!in_array($file,$not_include)) )
{
//add 1 to counter
$tfiles++;
//print through all files add each to the table
print " ";
print "<TR>";
print "<TD align=\"right\" bgcolor=\"#B4B4B4\">($tfiles)</TD>";
print "<TD bgcolor=\"#B4B4B4\">";
print " <a href=\"$url$file\" target=\"_blank\"><font face=\"arial\" color=\"#000000\" size=\"2\">$file</font></A> <BR>\n";
print "</TD>";
print "<TD bgcolor=\"#B4B4B4\">";
$size = "".filesize ("$ufolder$file")."";
$size = "".round(($size/1024), 2)."";
print "<font face=\"arial\" color=\"#000000\" size=\"2\"> $size KB </font>";
print "</TD>";
print "</TR>";
}
}
print "</table>";
print "<P>";
print "<table border=\"0\">";
print "<tr><td>";
print "Total files: $tfiles";
print "</td></tr>";
print "</table>";
//close directory
closedir( $dh );
print "</div>";
?>
---------- END PHP CODE ----------------------
---------- START SNIPPET CODE --------------
<!-- START OF SNIPPET -->
<table width="100%" border="0" cellspacing="1"
cellpadding="3">
<tr bgcolor="#e8e8e8" onMouseOver="this.bgColor =
'#FFBC58'"
onMouseOut="this.bgColor = '#e8e8e8'">
<td>WebThang</td>
<td>Snippets</td>
<td>JavaScript, ASP-VBScript, HTML, PHP, CSS,
...</td>
<td><a
href="http://www.webthang.co.uk/codebank/codebank.asp"
target="_top"
onFocus="if(this.blur)this.blur()">more...</a></td>
</tr>
<tr bgcolor="#e8e8e8" onMouseOver="this.bgColor =
'#FFBC58'"
onMouseOut="this.bgColor = '#e8e8e8'">
<td>WebThang</td>
<td>Resources</td>
<td>Dreamweaver, Databases & SQL, Paintshop Pro,
...</td>
<td><a
href="http://www.webthang.co.uk/resources/resource.asp"
target="_top"
onFocus="if(this.blur)this.blur()">more...</a></td>
</tr>
</table>
<!-- END OF SNIPPET -->
---------- END SNIPPET CODE --------------
Thanks in advance for any help you can give.
bmak