Forum Moderators: mack

Message Too Old, No Replies

Maintenance shortcuts

maintenance

         

ochorios

4:43 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



For a site which contains many static html pages which is updated regularly, what is the best way to make global changes?

For instance if I have common info such as an address, or multi-lined text in a table which appears on all pages - what methods can anyone suggest to make changes in one and have all updated at same time?

Or alternatively, how best to search and replace multiple lines of commonly appearing info on pages or in different directories or subdirectories at same time?

varya

5:04 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



I use Editpad and it has a global search and replace feature.

I just paste in the original text in the search box, place the new content in the replace box and hit "search and replace".

I haven't found an upper limit on the number of pages it can handle. I've done over 500 at a time.

HelenDev

5:15 pm on Mar 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like you should consider using include files. I think most web hosts will allow this with normal html pages provided they end .shtml

<!--#include file="subdir/file.ext"-->

Then you can update just one file which will appear in many pages across your site.

Ian_Cowley

5:20 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



I find the templating systesm in Macromedia Dreamweaver is more than adequate for managing most static sites.

You can have page templates that contain reusable components called library items. Dreamweaver also has a pretty nifty search and replace tool built in.

txbakers

8:09 pm on Mar 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any decent text editor such as the one mentioned above or TextPad will have advanced search/replace multiple file functionality.

It's very easy to do that way.

bruhaha

2:29 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



I think most web hosts will allow this with normal html pages provided they end .shtml

For that matter, the server can be told to allow .htm/.html files to use includes. This is much easier than changing all the page extensions to ".shtml" (which may also "break" links already listed in search engines, etc), though there can be a downside (see "caveat" below).

The following line in your .htaccess file will do it --
AddHandler server-parsed .html

Caveat: This command (whether it specifies .shtml or .html [and/or .htm, if you choose]) will force the server to parse every page of this type looking for includes. If many of your pages do not have includes, this is a lot of unnecessary, extra work for the server, and will also slow down the serving even of pages that have no includes. So I would only consider this approach if you plan to use includes on most of your pages.

(Also, check with your server before doing this. I think most will allow it, but it's possible some would treat it as a violation of the TOS. Also, if your host does not allow you to set up .htaccess files, you will have to ask them to make sure the server is set up to handle the includes... and it's possible they will tell you they will only do so with ".shtml" files.)