A client of mine had a website developed some years ago and has a very simple CMS which is based on a simple flat file database with a text file and perl script. The client does not want to pay for a rewrite of the site (my experience is in PHP) but wants to make a simple change to the site which I cannot work out with my very limited knowledge of perl.
From what I can see, the perl script does a number of substitutions from the site template. For instance $include[filename.html] entered into the template will mimic the equivalent of an SSI command. This only works when entering a filename. I need to change the script so it also calls in a script (banner script) or url.
How do I change the $include code below to make this happen. I understand I will need to use get and call LWP::Simple; from the beginning of the script, but I'm not sure what I else I need to do.
I thought about adding another variable $geturl and edited / duplicated the $include statement to no avail.
$formTemplate=~s/$geturl\[([^\]]+)]/qx(get ""$1"")/ge;
$formTemplate=~s/\$geturl/ /g;
Extract of script where template substitions are done.
$dateCreated=&getDate($id);
$formTemplate=~s/(\$if[^\}]*\})/&getIf($1)/ge;
$formTemplate=~s/\$data\[([0-9]+)\]/$data[$1]/g;
$formTemplate=~s/\$escape\[([0-9]+)\]/$escape[$1]/g;
$formTemplate=~s/\$fields\[([0-9]+)\]/$fields[$1]/g;
$formTemplate=~s/$include\[([^\]]+)]/qx(cat ""$1"")/ge;
$formTemplate=~s/\$include/ /g;
$formTemplate=~s/\$id/$id/g;
$formTemplate=~s/\$datecreated/$dateCreated/g;
$formTemplate=~s/\$membername/$owner/g;
if ($useCart) {
$tmp=&wtcart::addButton("cart1");
$formTemplate=~s/\$addbutton/<FORM NAME=\"cart1\">$tmp<\/FORM>/g;
}
print ($formTemplate);
};