In article <jg89ma$82r$
1...@solani.org>,
Udo Huebner <
udo.h...@t-online.de> wrote:
...
> >> If you need to change the menu across all your pages you use a search and
> >> replace utility that will find all content between the tokens and replace
> >> it
> >> with new content. This search and replace utility must be able to work
> >> across multiple files.
> >>
> >> Not as neat as PHP, but it works.
> >
> > A third way is to use Server Side Includes. But the S&R you describe
> > is the least frightening.
> >
>
> ... I should "try" to learn PHP anyway because you emphasize
> that PHP is neat! :-)
You don't really need to learn much PHP to use its includes functions,
you *can* treat it as a magic wand that does certain things if you get
certain simple things right. If your server supports php, the wand
will work straight off if you name any html files that have includes
in them with a .php end, it is the signal for the server to read the
programming instructions within and run them. Instead of index.html,
you would have index.php.
If you have a footer, that is the same for all pages, put the markup
for it in a separate text file and save this file with any ending you
like, .inc is popular. Create a new folder and call this whatever you
like, "includes" is sensible. Put the folder on your server, just as
you might put any folder like "images".
In all your html files (even though they might end in .php) at the
point at which you would normally have something like
<ul class="footer">
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
you instead put
<?php include ("includes/footer.inc"); ?>
The above ul markup above goes into the text file footer.inc in the
folder called includes.
This is particularly useful when you have a complicated bit of markup,
think drop-down menus. Changing the one file in the folder includes
ensures all your pages register the change.
What happens is this, the server sees any file that ends in .php and
checks it out for php instructions. In the case of the above include,
it fetches the content of the text file footer.inc in the folder
"includes" and dumps it in the html page at the point where the
include statement occurs. When it gets to the visitor's browser it
looks like a normal html page with lots of markup, what you see in the
View Source.
If all your html files are on the same level as the includes folder,
the server will find it and Bob should be your uncle. Me, I use a
global reference so that all my includes can be found from wherever,
but keep it simple to start off.
--
dorayme