04-17-2005, 03:05 PM
|
|
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Utopia
Posts: 6,484
|
Quote:
|
Originally Posted by prodiac
It would take me a bit more time than I have right now to get it in PHP, so I modified it a bit in perl ..
in _template.html this will be your original file you start with, The title line needs to be: <title>%%TITLE%%</title>
In the filelist, which I called filename_list.txt, the file needs to look like this:
Code:
someword1.html||Title for someword1 file goes here
someword2.html||Title for someword2 file goes here
someword3.html||Title for someword3 file goes here
And so on ..
Here is the modified script .. going out for the rest of the day right now, didn't test it, but it should work....
Code:
#!/usr/local/bin/perl
$template = "_template.html";
$files = "filename_list.txt
open (TPL, $template);
@tpllines=<TPL>;
close(TPL);
open (FILE, $files);
@allfiles=<FILE>;
close(FILE);
foreach $list (@allfiles) {
chop($list);
($name,$title) = split(/||/, $list);
open (NEWFILE, ">${name}");
foreach $line (@tpllines) {
chop($line);
$line =~ s/%%TITLE%%/$title/;
print NEWFILE "$line\n";
}
close(NEWFILE);
}
exit;
|
Nice, I don't need it per se, but I thought it was good to know. Will save it for future reference.
Thanks.
__________________
seks.ai for sale - ping me
|
|
|