Guest_imported
New member
- Jan 1, 1970
- 0
Ok, this bit of code has been fooling me for ages.
Basically, the eventual idea of this code is to replace all occurences of the [counter], [category] and [grand_total] occurences with <%category%>, <%grand_total%> and <%counter%>. However, it has not been this simple.
I have been submitting code that SHOULD have had all of these occurences changed asnd then printted out to the screen correctly. However, it has not been working.
Anyone got any ideas? Cos Im completely out
Thanks
Andy
Code:
sub update_home {
$code = $input->param('home');
print $code;
open(CODE2, ">/home/ace-clipart.com/public_html/directory/cgi/admin/templates/$username/home.html.new") || &error("Unable to open home.html template!. Reason: $!");
print $code;
close (CODE2);
open(CODE, ">/home/ace-clipart.com/public_html/directory/cgi/admin/templates/$username/home.html.new") || &error("Unable to open home.html template!. Reason: $!");
@newcode = <CODE>;
close (CODE);
foreach $code (@newcode) {
$code =~ s/counter1/counter/g;
$code =~ s/::grand_total::/grand_total/g;
$code =~ s/[category]/category/g;
}
print @newcode;
}
Basically, the eventual idea of this code is to replace all occurences of the [counter], [category] and [grand_total] occurences with <%category%>, <%grand_total%> and <%counter%>. However, it has not been this simple.
I have been submitting code that SHOULD have had all of these occurences changed asnd then printted out to the screen correctly. However, it has not been working.
Anyone got any ideas? Cos Im completely out
Thanks
Andy