Welcome to WebmasterWorld Guest from 188.8.131.52
Forum Moderators: open
I'm putting up a site with about a hundred static pages based on a single template. A major part of the content variation will involve city names. To save me some work in creating the pages, is there a way to define a variable near the beginning, and then reference this variable throughout the rest of the page?
For example, I might call the variable CITY. The page for Dallas would have code setting CITY equal to "Dallas" near the beginning, and would reference CITY at various places in the content. I would then just need to change this one item for each page I do.
(I know a dynamic structure might seem better suited, but I need to stick with .html pages.)
HTML can't do that, it was never designed to but you can do it easily with PHP (a server side programming language).
You'd need to define that variable somewhere though and decide on page where and under what conditions to show it. Unfortunately, you have a lot of reading to do ;)
Try [php.net...] for a beginners tutorial and good luck!
I come from the world of UNIX, where pre-processing is a standard procedure. When starting to develop my web site I was searching for a way to include files and found a FAQ answering the question How do I include one file in another? [htmlhelp.com]. The main point was:
Two popular ways of including the contents of one file seamlessly into another for the WWW are preprocessing and server-side inclusion. A preprocessor converts its source into a plain HTML document that you publish on your server. In contrast, documents that use server-side inclusion are processed every time the document is retrieved from the server.
I use a free preprocessor called GTML (G comes before H :) ) written in perl and am very happy with it. There are very many similar products available, it does help to think like a programmer if you use any of them :)