I hope this file doesn't show up HTML encoded. I'm dinking with the newest
version of Eudora. Let me know if it is HTML.
This is pretty cool thanks. Here is some web design suggestion for the
list to make life much easier for you over the long haul:
Instead of inserting HTML code as your header/footer you should use the
include file option (PHP supports this and I'm sure perl can as well
someway and server side includes obviously do). That way your header and
footers are just include statements that point to files that can be
manipulated independent of the web site. I do this for my Navigation as
well. Each web page then is a standard template that has a header include,
a footer include and a navigation include.
I can change my whole navigation across my site and I just have to edit one
file. :) You can even take this to the extreme and have your graphic's
loaded dynamically based upon the name of the web page being loaded.
I've done this setup on two sites and maintenance is a piece of cake.
You could tweak this script to add the include statements and use it to
retrofit older sites. :)
Scott
At 03:54 PM 12/14/99 Tuesday, you wrote:
>I hope no one minds me sharing my source code, but I thought this script was
>pretty cool. It allows you to modify an entire directory of html files. If you
>check
>
>http://www.brie.com/bbd/
>
>and then look at
>
>http://www.brie.com/~brian/bbd/
>
>You will notice with the script I added a banner to the beginning of every
>page.
>This is certainly a nice tool if you are managing a large site.
>
>Get this, this script modified about two hundred files in about five seconds.
>Here's my machines specs:
>
>300 MHz AMD K6-2
>128 Mb RAM
>100 MHz Bus
>Symbios UW SCSI
>Quantum 3 Gig 5400rpm HD
>
>
>#!/usr/bin/perl
>
># Configuration Variables
># Change these variables to match your web server's configuration
>
>
>$base_dir = "/home/brian/public_html/bbd";
>
>
>use File::Find;
>
>
>finddepth(\&wanted, $base_dir);
>
>
>sub wanted {
>
> if (/\.html$/) {
>
> $file = "$File::Find::name";
> $old = "$file";
> $new = "$file.tmp.$$";
> $bak = "$file.bak";
>
> open(OLD, "< $old") or die "can't open $old: $!";
> open(NEW, "> $new") or die "can't open $new: $!";
>
>
> # Correct typos, preserving case
> while (<OLD>) {
> if (/<BODY.*?>/) {
> (print NEW $_) or die "can't write to $new: $!";
> print NEW '<!-- replace navigable bar begin -->',"\n";
> print NEW '<A HREF="/maps/brian.map">',"\n";
> print NEW '<IMG SRC="/brian/pictures/bar.gif" WIDTH=551 HEIGHT=28
> BORDER=0 ISMAP>',"\n";
> print NEW '</A>',"\n";
> print NEW '<!-- replace navigable bar end -->',"\n";
> } else {
> (print NEW $_) or die "can't write to $new: $!";
> }
> }
>
> close(OLD) or die "can't close $old: $!";
> close(NEW) or die "can't close $new: $!";
>
> rename($old, $bak) or die "can't rename $old to $bak: $!";
> rename($new, $old) or die "can't rename $new to $old: $!";
>
> }
>
>}
>
>
>--
>Brian Lavender
>http://www.brie.com/brian/
>****************************************************************************
>* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
>* in the message body to majordomo@saclug.org. Please direct other
>* questions, comments, or problems to lug-nuts-owner@saclug.org.
****************************************************************************
* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
* in the message body to majordomo@saclug.org. Please direct other
* questions, comments, or problems to lug-nuts-owner@saclug.org.
This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:09 PST