Forum Moderators: mack
Andreas
<table width="70%" border="0" cellspacing="0" cellpadding="4"><tr>
<td>This is the text I want to change</td>
</tr></table>
Do a find and replace and replace whatever you want changing in the table
<table width="70%" border="0" cellspacing="0" cellpadding="4"><tr>
<td>This is the link I want to add <a href="http://www.mysite.com">HOME</a></td>
</tr></table>
Dreamweaver wil warn you that any changes can't be undone with any pages which are not open
You can also do a find and replace for the head content for any changes you may require
Have Fun
1) i want ro replace ALL words on ALL pages
2) i want ro replace all words in the BODY which are visible to the user
so that the word when it appears in the meta tag or in a filename remains untouched, you know what i mean?
how can dreamweaver do this? with the normal "find and replace"-function it can't work because it can't exclude the non-body-part
#!/usr/bin/perl -w
#
use strict [perldoc.com];
#
use File::Find [perldoc.com];
use HTML::Parser [perldoc.com];
#
my $r = 0;
my $p = HTML::Parser->new(api_version => 3);
$p->handler( start => sub {
$r=1 if shift eq 'body';
$r=0 if shift eq 'a';
print OUT pop; }, "tagname,tagname,text");
$p->handler( end => sub {
$r=0 if shift eq 'body';
$r=1 if shift eq 'a';
print OUT pop; }, "tagname,tagname,text");
$p->handler( text => sub {
print(OUT shift), return unless $r;
local $_ = shift;
s!$ARGV[1]!$ARGV[2]!go;
print OUT }, "text");
$p->handler( default => sub { print OUT shift }, "text");
#
find(sub [perldoc.com] {
return [perldoc.com] if -d $File::Find::name;
return [perldoc.com] unless $File::Find::name =~ /\.html?$/;
open [perldoc.com] 'OUT', ">$File::Find::name.temp"
or die "Can't open $File::Find::name.temp: $!\n";
$r = 0;
$p->parse_file($File::Find::name)
or die "Can't parse file: $File::Find::name.temp: $!\n";
close [perldoc.com] 'OUT';
rename [perldoc.com]($File::Find::name, "$File::Find::name.orig");
rename("$File::Find::name.temp", $File::Find::name);
}, $ARGV[0] ¦¦ die);
Call it like so:
[*nix]./htmlrep /path/to/html/files name link
[windows]perl htmlrep c:\path\to\html\files name link
A real life example would be
Perl [perl.com] htmlrep c:\path\to\html\files "Aaron C." "<a href=''>Aaron C.</a>"
As you see this works both on GNU/Linux and Windows. If you donīt have it just grab the ActiveState Perl [perl.com] package and install it (Microsoft Installer - just one click). The script will then run without any configuration.
HTH Andreas
andreasfriedrich script seems to be the best option and I will study this script as well