Dave,
That is exactly what I was looking for!
I got it working but ran into some problems when modifying it to match the overall look of the site.
Currently there is a seperate sub for adding a review to an existing HTML page. This is great except that it uses the splice function to insert element into the middle of a list.
Quote:
foreach $file (@file) {
if ($file=~ /$in{'id'}/i) {
# if xxx.html is in $IdFile we open the existing review to add to it
#### Adding review to xxx.html ####
open (html, "<$reviews/$in{'id'}.html") or &error("Unable to open $in{'id'}.html, pleas delete the reference in $IdFile");
if ($flock eq "y") {flock html, 2;
}
@html=<html>;
close (html);
$line=0;
foreach $html (@html) {$line++;
if ($html=~ /<!--$in{'id'}.html-->/i) {$line--;
if (!$in{'email'}) {$by="$in{'name'}";
}
else {$by="<a href=\"mailto:$in{'email'}\">$in{'name'}</a>";
}
# we add the following LONG LINE HERE
@reply="\n<!--start-->\n<tr><td>$by </td>\n<td><small>$date at $time</small></td></tr>\n<tr><td><!--IP: $ENV{'REMOTE_HOST'}--></td>\n<td>$in{'review'}<hr></td></tr>\n<!--end-->\n<!--$in{'id'}.html--> \n";
splice (@html, $line, 1, @reply);
open (whtml, ">$reviews/$in{'id'}.html") or &error("Unable to write to $in{'id'}.html, chmod it 766.");
if ($flock eq "y") {flock whtml, 2;
}
print whtml @html;
close (whtml);
} # end if
} # end foreach
where this conflicts with what i need it to do...
Instead of having each review as part of the same table I have them set up as individual tables. When this splices the elements into the existing page it is merely adding more TDs and TRs to an existing TABLE.
I've changed the output in the other subs but when I try and change this one odd things happen, like it doesn't print /TABLEs properly.
So what I'd like to do is get rid of the splice (I think that would work) and merely print the output the same way it was printed when it prints a new HTML page.
Did that make any sense? Cause I'm lost myself...
-Norm