Skip to content

Changing text on web pages – Part 1

Quite often you’ll want to make a web site with Frontpage that has text that changes occasionally. In this issue we’ll cover the basics and the in-built Frontpage method.

PUTTING CHANGING TEXT IN WEB PAGES

Quite often you’ll want to make a web site with Frontpage that has text that changes occasionally. While most of the site stays the same, you may want to change some details that appear in many places on the web site, like prices, opening hours etc. Or you might have similar web sites where only some details change for each site.

Having dynamic text lets you put the changed text in one place and have it show up automatically in all the spots it appears on the web site.

There are various ways you can do this. One is only available in Frontpage while others can be used in Frontpage and other web page editors. Which one you use depends on your needs, level of expertise, the services available on your web site host and type of web page editor you use or might use.

As with many things, there are advantages and disadvantages to each option. We suggest that you be consistent across an entire web site and use the one method throughout. That will make your site simpler to understand than if you have dynamic text setup in different places on the one site.

In this first issue of 2006 we’ll cover the basics and the in-built Frontpage method. In later issues we’ll cover more advanced methods.


THE BASICS

If you’ve done even basic programming the basics of these techniques will be familiar. We’re talking about creating variables which are applied at some time to the web pages.

Each bit of dynamic text has two parts – the label for the text and the text itself, for example:



  • Product – Office Extras Handbook
  • Author – Peter Deegan

In programming terms you’d call these the variable name and the value.

All of these methods are some way of changing a label like ‘Product’ into ‘Office Extras Handbook’ for the reader to see.

The name of a book might not change on a web site and so you might think making it a variable is a waste of time. However you might want to copy an existing web page or site for a new product – using these techniques you can be sure that the text on the new site is consistent.

Some of these techniques make the change directly to the web page immediately, others make the changes to the web page when it is published to your web site host, while the more advanced methods update the page each time it is viewed.

FRONTPAGE SUBSTITUTION

This option is only available with FrontPage with a Frontpage enabled web site, published using Frontpage (not a separate FTP program) but can be useful in some circumstances. It is simple to use with Frontpage doing all the work for you.

To setup the dynamic text go to Tools | Site Settings | Substitution and you’ll see a list of substitutions already in place. Click on Add to give a name to your substitution text and then the text itself.

Inserting your text is done via Insert | Web Component | Included Content | Substitution – choose the variable from the pull-down list and Frontpage will insert some code into your web page. In Preview view the value will show up. In code view you’ll see something like this:

This tells Frontpage what to update and where on your web page.

This is simple but has some limitations. As we mentioned before, you have to use Frontpage to publish the web site to your web server. It only works in Frontpage so if you switch to another HTML editor (like the old favorite Notepad) this option will stop working. It is limited to short text phrases and you’ll have difficulty if you want to insert longer chunks of text or code.


SIMPLE SEARCH AND REPLACE

An obvious option is to simply do a search and replace through all the web pages, any decent web editor will let you do a replace across an entire web site not just the currently open page. Frontpage has this option on the Replace menu.

The problem with doing this on a global, automatic fashion is that you have to make sure that absolutely all instances of the text need to be replaced. Often in real world situations there are exceptions that you have to keep in mind.

For example you might have a club president called ‘Fred Dagg’, when the presidency changes hands you could replace all instances of ‘Fred Dagg’ with ‘Bruce Bayliss’ but that would also change all the places where Fred is listed in other club roles (eg a members list, list of past presidents etc).

Simple search and replace works on any web site and isn’t dependant on Frontpage.

In the next issue we’ll talk about a smarter way to do search and replace plus options using a fraction of the power of web programming.

 

About this author

Office 2024 - all you need to know. Facts & prices for the new Microsoft Office. Do you need it?

Microsoft Office upcoming support end date checklist.