Excellent! Now I am just having a problem. Here is the PHP code, as of right now, I'll tell you after the code what it is doing and what the output is...
$_counter = 0;
$_a_counter = 0;
$_table_counter = 0;
$_tablecounterandall = 0;
$_table_to_print = <<<EOF
<tr valign="middle">
EOF;
$photo_directory = "/home/user/public_html/images/" . $gallery;
if ($handle = opendir($photo_directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (!preg_match("/\.(jpg|gif|jpeg|png)$/i", $file)) {
continue;
}
$_counter++;
if ($_table_counter > 2) {
$_table_counter = 0;
$_tables_and_me = $_tables_and_me . "1+";
$_table_to_print = $_table_to_print . <<<EOF
</tr>
<tr valign="middle">
<td>
<script language="JavaScript">
document.write('<a href="javascript:;" onclick="window.open(\\'ShowPic.cgi?img=gallery/$file\\',\\'POPUP_IMAGE\\',\\'toolbar=no,location=no,menu=no,resizable=no,status=no,scrollbars=yes,top=50,left=100,height=350,width=350\\'); return false;"><img width="$_picture_thumbnail_size" alt="Portfolio Image Number: $_counter" src="$__gallery_url/$gallery/$file" border="0"></a>');
</script>
<noscript><a href="ShowPic.cgi?img=$gallery/$file" target="_blank"><img width="$_picture_thumbnail_size" alt="Portfolio Image Number: $_counter" src="$__gallery_url/$gallery/$file" border="0"></a></noscript>
</td>
EOF:
$_table_counter++;
$_tablecounterandall = $_tablecounterandall+$_table_counter;
} else {
$_tables_and_me = $_tables_and_me . "1+";
$_table_to_print = $_table_to_print . <<<EOF
<td bgcolor="#990000" style="color: #FFFFFF">
$_counter
</td>
<td>
<script language="JavaScript">
document.write('<a href="javascript:;" onclick="window.open(\\'ShowPic.cgi?img=gallery/$file\\',\\'POPUP_IMAGE\\',\\'toolbar=no,location=no,menu=no,resizable=no,status=no,scrollbars=yes,top=50,left=100,height=350,width=350\\'); return false;"><img width="$_picture_thumbnail_size" alt="Portfolio Image Number: $_counter" src="$__gallery_url/$gallery/$file" border="0"></a>');
</script>
<noscript><a href="ShowPic.cgi?img=gallery/$file" target="_blank"><img width="$_picture_thumbnail_size" alt="Portfolio Image Number: $_counter" src="$__gallery_url/$gallery/$file" border="0"></a></noscript>
</td>
EOF;
$_table_counter++;
$_tablecounterandall = $_tablecounterandall+$_table_counter;
}
$_a_counter++;
}
}
closedir($handle);
}
if($_table_to_print) {
$_page_content .= <<<EOF
<center>I found $_counter Pictures in this Gallery, click on one of them to view it full size...$_tables_and_me$_tablecounterandall</center>
<table border="0" bordercolor="#990000" width="75%" align="center" cellpadding="2" cellspacing="2">
$_table_to_print
</tr>
</table>
EOF;
}
Ok, $_counter is working I know that because the output shows this:
I found 5 Pictures in this Gallery, click on one of them to view it full size...0
I put $_tablecounterandall in there just as a test to see if it is running all the way through but it is NOT. It appears to not be running past this:
if ($_table_counter > 2) {
Right above that is where the $_counter get's incremented. So I know it's getting to there. This if statement that it appears to be failing at, is not even doing the "else" statement.
Can you see a reason why it would not be working?
Thank you again, very much!
Richard