OT--HTML coding question

Mark Jarvis m.jarvis at cox.net
Sun Feb 26 22:33:27 MST 2012


Thanks! It sounds like a good solution. If this was a commercial web 
site I'd probably do it. However this is something I'm doing on a 
volunteer basis using donated space and I'm trying to keep everything 
small and simple--especially simple.

Once again, thanks!

Mark

Matt Graham wrote:
> From: Mark Jarvis<m.jarvis at cox.net>
>> I have a web site with a large number of hand coded pages. I have a
>> block of code that needs to be inserted into each page. The problem is
>> that the block will change occasionally as new material is added.
>> Obviously, things would be much simpler if I could make the change in
>> one place and have each page attach/include/link to/etc. a file
>> containing that piece of code. If there is an HTML construct that allows
>> that, I haven't found it.
> It's called "server-side includes", and it's relatively standard if you're
> using Apache.  You have to have the directory you want to have server-side
> includes enabled in with a config stanza kind of like so:
>
> <Directory "/var/www/localhost/htdocs">
>     Options Indexes FollowSymLinks Includes
> </Directory>
> # note that Includes is the option you want to have enabled for this dir.
> # that's the docroot of my webhost; modify for your setup
> # make sure to restart apache if you change the config file
>
> Once this has been done, all you have to do is to put a construct like so into
> foobar.html:
>
> <!--#include virtual="/incs/nav.html" -->
>
> ...this tells apache that when it's reading foobar.html, it should read the
> file /var/www/localhost/htdocs/incs/nav.html and insert that file's contents
> into foobar.html at that point, before sending stuff to the client.[0]  This
> is *really* useful.  At work, we basically depend on apache SSI to do 5 tons
> of stuff, since many pages use the same stuff across the whole site for
> navigation/menu bars/whatever.
>
> If this didn't make any sense, holler.
>
> [0] It can get a bit more complex than that, what with RewriteRules and other
> stuff, but that'll get you started.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120226/799085a1/attachment.html>


More information about the PLUG-discuss mailing list